Skip to content

Commit 3bd75bd

Browse files
committed
fix: Python 3.14 name change
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 77f03f4 commit 3bd75bd

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!");

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: 3.11",
2323
"Programming Language :: Python :: 3.12",
2424
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.14",
2526
"Programming Language :: Python :: Implementation :: PyPy",
2627
"Programming Language :: Python :: Implementation :: CPython",
2728
"Programming Language :: C++",

0 commit comments

Comments
 (0)