Skip to content

Commit 0c119d2

Browse files
committed
fix: add a test and comment
1 parent b5b5f43 commit 0c119d2

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ jobs:
6969
python-version: ${{ matrix.python }}
7070

7171
- name: Setup Boost (Linux)
72-
if: runner.os == 'Linux'
72+
# Can't use boost + define _
73+
if: runner.os == 'Linux' && matrix.python != '3.6'
7374
run: sudo apt-get install libboost-dev
7475

7576
- name: Setup Boost (macOS)

include/pybind11/detail/descr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ constexpr descr<N - 1> const_str(char const(&text)[N]) { return descr<N - 1>(tex
5858
constexpr descr<0> const_str(char const(&)[1]) { return {}; }
5959

6060
// The "_" might be defined as a macro - don't define it if so.
61+
// Repeating the const_str code to avoid introducing a #define.
6162
#ifndef _
6263
template <size_t N>
6364
constexpr descr<N - 1> _(char const(&text)[N]) { return descr<N - 1>(text); }

tests/test_custom_type_casters.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ class ArgAlwaysConverts { };
1818
namespace pybind11 { namespace detail {
1919
template <> struct type_caster<ArgInspector1> {
2020
public:
21+
// Classic
22+
#ifndef _
23+
PYBIND11_TYPE_CASTER(ArgInspector1, _("ArgInspector1"));
24+
#else
2125
PYBIND11_TYPE_CASTER(ArgInspector1, const_str("ArgInspector1"));
26+
#endif
2227

2328
bool load(handle src, bool convert) {
2429
value.arg = "loading ArgInspector1 argument " +

0 commit comments

Comments
 (0)