Skip to content

Py_fopen and Py_fclose not exported from python3.dll on Windows #152805

Description

@sonVishal

Bug report

Bug description:

The functions Py_fopen and Py_fclose introduced in PR#127821 are not visible on Windows.

Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34436 for x64
Windows SDK Version: 10.0.26100.0

Tested on: CPython 3.14.6

Command used for compilation: PCbuild\build.bat -p x64 -r -t Rebuild -e

I am not sure if these two APIs should be part of the stable ABI but we need them for the same reason mentioned in Issue#127350. We are upgrading to Python 3.14 from 3.12 and since _Py_wfopen is no longer exposed we are trying to replace it with Py_fopen and Py_fclose.

We load python3.dll via LoadLibrary Win32 API and then search for Py_fopen and Py_fclose via GetProcAddress Win32 API. These two symbols (Py_fopen and Py_fclose) cannot be found.

dumpbin /exports PCbuild\amd64\python3.dll | findstr Py_fopen returns empty after building.

Potential solution:
Should add the following to stable_abi.toml?

[function.Py_fopen]
    added = '3.14'
[function.Py_fclose]
    added = '3.14'

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions