@@ -2171,10 +2171,6 @@ class argument_loader {
21712171
21722172// / Helper class which collects only positional arguments for a Python function call.
21732173// / A fancier version below can collect any argument, but this one is optimal for simple calls.
2174- // Disable warnings about useless comparisons when N == 0.
2175- PYBIND11_WARNING_PUSH
2176- PYBIND11_WARNING_DISABLE_GCC (" -Wtype-limits" )
2177- PYBIND11_WARNING_DISABLE_INTEL(186 )
21782174template <size_t N, return_value_policy policy>
21792175class simple_collector {
21802176public:
@@ -2189,6 +2185,9 @@ class simple_collector {
21892185 .inc_ref ()
21902186 .ptr (),
21912187 0 )...};
2188+ PYBIND11_WARNING_PUSH
2189+ PYBIND11_WARNING_DISABLE_GCC (" -Wtype-limits" )
2190+ PYBIND11_WARNING_DISABLE_INTEL (186 )
21922191 for (i = 0 ; i < N; ++i) {
21932192 if (!m_args[i]) {
21942193#if !defined(PYBIND11_DETAILED_ERROR_MESSAGES)
@@ -2199,12 +2198,17 @@ class simple_collector {
21992198#endif
22002199 }
22012200 }
2201+ PYBIND11_WARNING_POP
22022202 }
22032203
22042204 ~simple_collector () {
2205+ PYBIND11_WARNING_PUSH
2206+ PYBIND11_WARNING_DISABLE_GCC (" -Wtype-limits" )
2207+ PYBIND11_WARNING_DISABLE_INTEL (186 )
22052208 for (size_t i = 0 ; i < N; ++i) {
22062209 handle (m_args[i]).dec_ref ();
22072210 }
2211+ PYBIND11_WARNING_POP
22082212 }
22092213
22102214 simple_collector (const simple_collector &) = delete ;
@@ -2214,9 +2218,13 @@ class simple_collector {
22142218
22152219 tuple args () const {
22162220 tuple result (N);
2221+ PYBIND11_WARNING_PUSH
2222+ PYBIND11_WARNING_DISABLE_GCC (" -Wtype-limits" )
2223+ PYBIND11_WARNING_DISABLE_INTEL (186 )
22172224 for (size_t i = 0 ; i < N; ++i) {
22182225 PyTuple_SET_ITEM (result.ptr (), i, handle (m_args[i]).inc_ref ().ptr ());
22192226 }
2227+ PYBIND11_WARNING_POP
22202228 return result;
22212229 }
22222230 dict kwargs () const { return {}; }
@@ -2237,7 +2245,6 @@ class simple_collector {
22372245
22382246private:
22392247 std::array<PyObject *, N> m_args;
2240- PYBIND11_WARNING_POP
22412248};
22422249
22432250// / Helper class which collects positional, keyword, * and ** arguments for a Python function call
0 commit comments