mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-12 17:26:13 +00:00
fix severe regression involving character arrays (fixes #137)
This commit is contained in:
@@ -22,6 +22,7 @@ void init_ex10(py::module &);
|
||||
void init_ex11(py::module &);
|
||||
void init_ex12(py::module &);
|
||||
void init_ex13(py::module &);
|
||||
void init_issues(py::module &);
|
||||
|
||||
PYBIND11_PLUGIN(example) {
|
||||
py::module m("example", "pybind example plugin");
|
||||
@@ -39,6 +40,7 @@ PYBIND11_PLUGIN(example) {
|
||||
init_ex11(m);
|
||||
init_ex12(m);
|
||||
init_ex13(m);
|
||||
init_issues(m);
|
||||
|
||||
return m.ptr();
|
||||
}
|
||||
|
||||
18
example/issues.cpp
Normal file
18
example/issues.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
example/issues.cpp -- collection of testcases for miscellaneous issues
|
||||
|
||||
Copyright (c) 2015 Wenzel Jakob <wenzel@inf.ethz.ch>
|
||||
|
||||
All rights reserved. Use of this source code is governed by a
|
||||
BSD-style license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "example.h"
|
||||
|
||||
|
||||
void init_issues(py::module &m) {
|
||||
py::module m2 = m.def_submodule("issues");
|
||||
|
||||
// #137: const char* isn't handled properly
|
||||
m2.def("print_cchar", [](const char *string) { std::cout << string << std::endl; });
|
||||
}
|
||||
8
example/issues.py
Normal file
8
example/issues.py
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
||||
from example.issues import print_cchar
|
||||
|
||||
print_cchar("const char *")
|
||||
1
example/issues.ref
Normal file
1
example/issues.ref
Normal file
@@ -0,0 +1 @@
|
||||
const char *
|
||||
Reference in New Issue
Block a user