Safeguard
Developer Tools•

Upgrading to Python 3.15: what should I check first?

Python 3.15 makes UTF-8 the default file encoding, removes some APIs and changes tarfile behavior. A short checklist for testing the upgrade.

Safeguard Security Team
3 min read

Check four things first when upgrading to Python 3.15: the new UTF-8 default for file I/O, removed or deprecated APIs, tarfile extraction changes, and native extensions built with frame pointers. The official What's New page lists them. Test with warnings on, and read the Porting section before you ship.

Why this release matters

Python 3.15 was first released on 2026-10-09 according to the developer guide. It will receive bugfix releases first and security fixes until October 2031. New releases are also where behavior changes land, so test before you move production.

The upgrade relevant changes

From the Python 3.15 What's New page:

  • UTF-8 is the default encoding for open() and other I/O that does not pass an encoding argument. You can revert with PYTHONUTF8=0 or -X utf8=0, but passing an explicit encoding is the portable fix.
  • __cached__ was removed from modules. Use __spec__.cached.
  • importlib.metadata now raises MetadataNotFound instead of returning an empty object when metadata is missing.
  • tarfile extract calls no longer extract rejected members when errorlevel is 0, and there is a new LinkFallbackError.
  • Frame pointers are enabled by default. Build tools must preserve the frame pointer flags from sysconfig when compiling native code.
  • The profile module is deprecated, scheduled for removal in 3.17.
  • Removals touch ast, collections.abc, ctypes, datetime, glob, http.server, importlib, pathlib, platform, threading, typing and others. I read only part of that page, so check the Removed and Porting sections for the exact items.

A testing checklist

  1. Run your tests with -W error in a branch, so deprecations fail loudly.
  2. Search for open( calls without encoding. Fix them, especially in code that reads files created on other systems.
  3. Grep for __cached__, profile, and the removed modules listed in the Porting guide.
  4. Rebuild every package that compiles native code and run its tests.
  5. Re-run your tarfile handling tests, including malicious archive cases. See tarfile extraction filters.
  6. Check your lock file resolves on 3.15 and that wheels exist.

Pin the interpreter

Make the version explicit so a laptop and CI agree. Use a .python-version file or your build tool's equivalent, plus the base image tag.

Try it yourself

The framework mapping demo shows how a technical finding can be tied to a control. A runtime upgrade can be tracked the same way, as evidence that a supported version is in use.

Click through it at your own pace, or open it full screen.

Safeguard's dependency scanning and compliance evidence automation can record what versions a project uses over time. The free scan is at gold.safeguard.sh/scan.

Quick check

Will the UTF-8 default break my code?

Only if you rely on a platform specific default encoding. Pass encoding explicitly and test with sample files.

Is it safe to upgrade the day it is released?

Test first. Native packages may not have wheels for a new release yet.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.