Skip to content

Python 3.14: __annotate__ NotImplementedError on annotated pytest fixtures, tests and pydantic models #1971

@pavel-slama

Description

@pavel-slama

Didn't find this reported specifically, hence filing a new bug.
Not sure if it's debugger problem or pydantic / pytest / possibly others.

Environment data

  • debugpy version: 1.8.16 baked in ms-python.debugpy-2025.15.2025110302-linux-x64
  • OS and version: Fedora 42 kernel 6.17.5-200.fc42.x86_64
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.14.0 (main, Oct 7 2025, 00:00:00) [GCC 15.2.1 20250808 (Red Hat 15.2.1-1)] on linux
  • Using VS Code or Visual Studio:
    VS Code
    Version: 1.105.1
    Commit: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084
    Date: 2025-10-14T22:33:36.618Z
    Electron: 37.6.0
    ElectronBuildId: 12502201
    Chromium: 138.0.7204.251
    Node.js: 22.19.0
    V8: 13.8.258.32-electron.0
    OS: Linux x64 6.17.5-200.fc42.x86_64

Actual behavior

Debugger raises "User Uncaught Exceptions" on every annotated pytest fixture and pydantic model on python 3.14 when they're imported (I guess it tries to inspect annotations in wrong way or these libraries are somehow mangling the new annotations).
On python 3.13 - it works fine (no exceptions).

Exception has occurred: NotImplementedError       (note: full exception trace is shown but execution is paused at: __annotate__)
exception: no description
  File "/home/pslama/wrkspaces/test/test_annotations.py", line 25, in __annotate__ (Current frame)
    class AnnotatedTest(BaseModel):
    
  File "/home/pslama/wrkspaces/test/test_annotations.py", line 25, in <module>
    class AnnotatedTest(BaseModel):
NotImplementedError: 

Expected behavior

No such exceptions.

Steps to reproduce:

  1. Create py3.14 venv with pydantic and pytest packages
  2. Configure pytest as test runner in VS Code test explorer
  3. Create test_anything.py file containing pydantic model and/or annotated pytest fixture and test function
  4. Check User Uncaught Exceptions in Run and Debug panel
  5. Run Debug Tests from test explorer

I made example repo: https://github.com/pavel-slama/py3.14-annotate-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions