Skip to content

Commit 1d7f2b3

Browse files
committed
Use PY_VERSION_HEX for a cleaner CVE-2008-5983 mode check.
1 parent 3aa548f commit 1d7f2b3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

include/pybind11/embed.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ inline void set_interpreter_argv(int argc, char** argv, bool add_current_dir_to_
152152
auto pysys_argv = safe_argv;
153153
#endif
154154

155-
#if PY_MAJOR_VERSION == 2 && (PY_MINOR_VERSION < 6 || (PY_MINOR_VERSION == 6 && PY_MICRO_VERSION < 6)) || \
156-
PY_MAJOR_VERSION == 3 && (PY_MINOR_VERSION < 1 || (PY_MINOR_VERSION == 1 && PY_MICRO_VERSION < 3))
157-
// These python versions don't have PySys_SetArgvEx, so we have to use the workaround
155+
#if PY_VERSION_HEX < 0x020606f0 || (PY_MAJOR_VERSION == 3 && PY_VERSION_HEX < 0x030103f0
156+
// These python versions don't have PySys_SetArgvEx, so we have to use the approach
158157
// recommended by https://docs.python.org/3.5/c-api/init.html#c.PySys_SetArgvEx
159158
// to work around CVE-2008-5983
160159
PySys_SetArgv(argc, pysys_argv);

0 commit comments

Comments
 (0)