---
id: CVE-2026-2297
title: >-
  The import hook in CPython that handles legacy *.pyc files
  (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and
  so does not use io.open_code() to read the .pyc files
summary: >-
  The import hook in CPython that handles legacy *.pyc files
  (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and
  so does not use io.open_code() to read the .pyc files. sys.audit handlers for
  this audit event ther…
severity: none
cwe:
  - CWE-668
published: '2026-03-04'
updated: '2026-08-05'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-2297'
references:
  - url: >-
      https://github.com/python/cpython/commit/482d6f8bdba9da3725d272e8bb4a2d25fb6a603e
    label: cna@python.org
  - url: >-
      https://github.com/python/cpython/commit/69ddd9bb2cc4bd69b1565647c18659c6a789ccd9
    label: cna@python.org
  - url: >-
      https://github.com/python/cpython/commit/876858c9f65d9ab656c7fa639f268ce7856d89dd
    label: cna@python.org
  - url: >-
      https://github.com/python/cpython/commit/a51b1b512de1d56b3714b65628a2eae2b07e535e
    label: cna@python.org
  - url: >-
      https://github.com/python/cpython/commit/c70adad78caeeea33f92f560ecb93331ca11bf66
    label: cna@python.org
  - url: >-
      https://github.com/python/cpython/commit/e58e9802b9bec5cdbf48fc9bf1da5f4fda482e86
    label: cna@python.org
  - url: 'https://github.com/python/cpython/issues/145506'
    label: cna@python.org
  - url: 'https://github.com/python/cpython/pull/145507'
    label: cna@python.org
  - url: 'http://www.openwall.com/lists/oss-security/2026/03/05/6'
    label: af854a3a-2127-422b-91ae-364da2661108
tags:
  - nvd
epss: 0.00212
epssPercentile: 0.11765
ingestedAt: '2026-08-05T11:47:23.818Z'
---

## Overview

The import hook in CPython that handles legacy *.pyc files (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and so does not use io.open_code() to read the .pyc files. sys.audit handlers for this audit event therefore do not fire.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
