Skip to content

Commit fdbbb8a

Browse files
committed
fix: missing include
1 parent 0a82626 commit fdbbb8a

File tree

7 files changed

+12
-29
lines changed

7 files changed

+12
-29
lines changed

include/pybind11/detail/internals.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include "../pytypes.h"
1313

14+
#include <exception>
15+
1416
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
1517
PYBIND11_NAMESPACE_BEGIN(detail)
1618
// Forward declarations
@@ -100,9 +102,7 @@ struct internals {
100102
std::unordered_set<std::pair<const PyObject *, const char *>, overload_hash> inactive_overload_cache;
101103
type_map<std::vector<bool (*)(PyObject *, void *&)>> direct_conversions;
102104
std::unordered_map<const PyObject *, std::vector<PyObject *>> patients;
103-
#if !defined (__PGIC__)
104105
std::forward_list<void (*) (std::exception_ptr)> registered_exception_translators;
105-
#endif
106106
std::unordered_map<std::string, void *> shared_data; // Custom data to be shared across extensions
107107
std::vector<PyObject *> loader_patient_stack; // Used by `loader_life_support`
108108
std::forward_list<std::string> static_strings; // Stores the std::strings backing detail::c_str()
@@ -214,7 +214,6 @@ inline internals **&get_internals_pp() {
214214
return internals_pp;
215215
}
216216

217-
#if !defined (__PGIC__)
218217
inline void translate_exception(std::exception_ptr p) {
219218
try {
220219
if (p) std::rethrow_exception(p);
@@ -233,7 +232,6 @@ inline void translate_exception(std::exception_ptr p) {
233232
return;
234233
}
235234
}
236-
#endif
237235

238236
#if !defined(__GLIBCXX__)
239237
inline void translate_local_exception(std::exception_ptr p) {
@@ -270,9 +268,7 @@ PYBIND11_NOINLINE inline internals &get_internals() {
270268
//
271269
// libstdc++ doesn't require this (types there are identified only by name)
272270
#if !defined(__GLIBCXX__)
273-
#if !defined (__PGIC__)
274271
(*internals_pp)->registered_exception_translators.push_front(&translate_local_exception);
275-
#endif
276272
#endif
277273
} else {
278274
if (!internals_pp) internals_pp = new internals*();
@@ -298,9 +294,7 @@ PYBIND11_NOINLINE inline internals &get_internals() {
298294
internals_ptr->istate = tstate->interp;
299295
#endif
300296
builtins[id] = capsule(internals_pp);
301-
#if !defined (__PGIC__)
302297
internals_ptr->registered_exception_translators.push_front(&translate_exception);
303-
#endif
304298
internals_ptr->static_property_type = make_static_property_type();
305299
internals_ptr->default_metaclass = make_default_metaclass();
306300
internals_ptr->instance_base = make_object_base_type(internals_ptr->default_metaclass);

include/pybind11/pybind11.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
# include <cxxabi.h>
5151
#endif
5252

53+
#include <exception>
54+
5355
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
5456

5557
/// Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object
@@ -740,7 +742,6 @@ class cpp_function : public function {
740742
- do nothing and let the exception fall through to the next translator, or
741743
- delegate translation to the next translator by throwing a new type of exception. */
742744

743-
#if !defined (__PGIC__)
744745
auto last_exception = std::current_exception();
745746
auto &registered_exception_translators = get_internals().registered_exception_translators;
746747
for (auto& translator : registered_exception_translators) {
@@ -752,7 +753,6 @@ class cpp_function : public function {
752753
}
753754
return nullptr;
754755
}
755-
#endif
756756
PyErr_SetString(PyExc_SystemError, "Exception escaped from default exception translator!");
757757
return nullptr;
758758
}
@@ -1853,13 +1853,11 @@ template <typename InputType, typename OutputType> void implicitly_convertible()
18531853
pybind11_fail("implicitly_convertible: Unable to find type " + type_id<OutputType>());
18541854
}
18551855

1856-
#if !defined (__PGIC__)
18571856
template <typename ExceptionTranslator>
18581857
void register_exception_translator(ExceptionTranslator&& translator) {
18591858
detail::get_internals().registered_exception_translators.push_front(
18601859
std::forward<ExceptionTranslator>(translator));
18611860
}
1862-
#endif
18631861

18641862
/**
18651863
* Wrapper to generate a new Python exception type.

tests/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ if(PYTHON_VERSION VERSION_LESS 3.5)
125125
"Skipping test_async on Python 2")
126126
endif()
127127

128-
if(CMAKE_CXX_COMPILER_ID MATCHES "PGI")
129-
pybind11_filter_tests(
130-
PYBIND11_TEST_FILES test_exceptions.cpp test_smart_ptr.cpp test_virtual_functions.cpp MESSAGE
131-
"Skipping tests that do not support PGI compilers")
132-
endif()
133-
134128
string(REPLACE ".cpp" ".py" PYBIND11_PYTEST_FILES "${PYBIND11_TEST_FILES}")
135129

136130
# Contains the set of test files that require pybind11_cross_module_tests to be

tests/test_exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import pytest
55

6-
m = pytest.importorskip("pybind11_tests.exceptions")
7-
import pybind11_cross_module_tests as cm # noqa: E402
6+
from pybind11_tests import exceptions as m
7+
import pybind11_cross_module_tests as cm
88

99

1010
def test_std_exception(msg):

tests/test_smart_ptr.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import pytest
3-
4-
m = pytest.importorskip("pybind11_tests.smart_ptr")
5-
6-
from pybind11_tests import ConstructorStats # noqa: E402
3+
from pybind11_tests import smart_ptr as m
4+
from pybind11_tests import ConstructorStats
75

86

97
def test_smart_ptr(capture):

tests/test_virtual_functions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class NCVirt {
139139
std::string print_movable(int a, int b) { return get_movable(a, b).get_value(); }
140140
};
141141
class NCVirtTrampoline : public NCVirt {
142-
#if !defined(__INTEL_COMPILER)
142+
#if !defined(__INTEL_COMPILER) && !defined(__PGIC__)
143143
NonCopyable get_noncopyable(int a, int b) override {
144144
PYBIND11_OVERLOAD(NonCopyable, NCVirt, get_noncopyable, a, b);
145145
}
@@ -205,7 +205,7 @@ TEST_SUBMODULE(virtual_functions, m) {
205205
.def(py::init<int, int>());
206206

207207
// test_move_support
208-
#if !defined(__INTEL_COMPILER)
208+
#if !defined(__INTEL_COMPILER) && !defined(__PGIC__)
209209
py::class_<NCVirt, NCVirtTrampoline>(m, "NCVirt")
210210
.def(py::init<>())
211211
.def("get_noncopyable", &NCVirt::get_noncopyable)

tests/test_virtual_functions.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
import env # noqa: F401
55

6-
m = pytest.importorskip("pybind11_tests.virtual_functions")
7-
8-
from pybind11_tests import ConstructorStats # noqa: E402
6+
from pybind11_tests import virtual_functions as m
7+
from pybind11_tests import ConstructorStats
98

109

1110
def test_override(capture, msg):

0 commit comments

Comments
 (0)