Skip to content

Commit 5156c8c

Browse files
committed
fix: Python 3.14 name change
Signed-off-by: Henry Schreiner <[email protected]>
1 parent ca2b96f commit 5156c8c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/pybind11/eval.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ object eval_file(str fname, object global = globals(), object local = object())
133133

134134
int closeFile = 1;
135135
std::string fname_str = (std::string) fname;
136-
FILE *f = _Py_fopen_obj(fname.ptr(), "r");
136+
FILE *f =
137+
# if PY_VERSION_HEX >= 0x030E0000
138+
Py_fopen(fname.ptr(), "r");
139+
# else
140+
_Py_fopen_obj(fname.ptr(), "r");
141+
# endif
137142
if (!f) {
138143
PyErr_Clear();
139144
pybind11_fail("File \"" + fname_str + "\" could not be opened!");

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ classifiers =
2020
Programming Language :: Python :: 3.11
2121
Programming Language :: Python :: 3.12
2222
Programming Language :: Python :: 3.13
23+
Programming Language :: Python :: 3.14
2324
License :: OSI Approved :: BSD License
2425
Programming Language :: Python :: Implementation :: PyPy
2526
Programming Language :: Python :: Implementation :: CPython

0 commit comments

Comments
 (0)