Skip to content

Commit 0e928c7

Browse files
bstaleticdrmoose
authored andcommitted
Use ifdefs instead of auto for pysys_argv decltype.
1 parent 6db8202 commit 0e928c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/pybind11/embed.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ struct embedded_module {
8989
}
9090
};
9191

92+
#if PY_VERSION_MAJOR >= 3
93+
#define PYBIND11_ARGV_TYPE wchar_t**
94+
#else
95+
#define PYBIND11_ARGV_TYPE char**
96+
#endif
97+
9298
struct wide_char_arg_deleter {
9399
void operator()(void* ptr) const {
94100
#if PY_VERSION_HEX >= 0x030500f0
@@ -147,10 +153,10 @@ inline void set_interpreter_argv(int argc, char** argv, bool add_current_dir_to_
147153
}
148154
}
149155

150-
auto pysys_argv = widened_argv.get();
156+
PYBIND11_ARGV_TYPE pysys_argv = widened_argv.get();
151157
#else
152158
// python 2.x
153-
auto pysys_argv = safe_argv;
159+
PYBIND11_ARGV_TYPE pysys_argv = safe_argv;
154160
#endif
155161

156162
PySys_SetArgv(argc, pysys_argv);

0 commit comments

Comments
 (0)