mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-12 03:37:46 +00:00
Merge branch 'master' into sh_merge_master
This commit is contained in:
commit
6acda67f62
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -10,6 +10,8 @@ on:
|
|||||||
- smart_holder
|
- smart_holder
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: test-sh-avl${{ github.ref }}
|
group: test-sh-avl${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
3
.github/workflows/configure.yml
vendored
3
.github/workflows/configure.yml
vendored
@ -10,6 +10,9 @@ on:
|
|||||||
- smart_holder
|
- smart_holder
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# For cmake:
|
# For cmake:
|
||||||
VERBOSE: 1
|
VERBOSE: 1
|
||||||
|
3
.github/workflows/format.yml
vendored
3
.github/workflows/format.yml
vendored
@ -13,6 +13,9 @@ on:
|
|||||||
- smart_holder
|
- smart_holder
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: 3
|
FORCE_COLOR: 3
|
||||||
# For cmake:
|
# For cmake:
|
||||||
|
5
.github/workflows/labeler.yml
vendored
5
.github/workflows/labeler.yml
vendored
@ -3,10 +3,15 @@ on:
|
|||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [closed]
|
types: [closed]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
label:
|
label:
|
||||||
name: Labeler
|
name: Labeler
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/labeler@main
|
- uses: actions/labeler@main
|
||||||
|
3
.github/workflows/pip.yml
vendored
3
.github/workflows/pip.yml
vendored
@ -13,6 +13,9 @@ on:
|
|||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PIP_ONLY_BINARY: numpy
|
PIP_ONLY_BINARY: numpy
|
||||||
|
|
||||||
|
3
.github/workflows/upstream.yml
vendored
3
.github/workflows/upstream.yml
vendored
@ -5,6 +5,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: upstream-${{ github.ref }}
|
group: upstream-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
@ -101,8 +101,11 @@ conversion has the same overhead as implicit conversion.
|
|||||||
m.def("str_output",
|
m.def("str_output",
|
||||||
[]() {
|
[]() {
|
||||||
std::string s = "Send your r\xe9sum\xe9 to Alice in HR"; // Latin-1
|
std::string s = "Send your r\xe9sum\xe9 to Alice in HR"; // Latin-1
|
||||||
py::str py_s = PyUnicode_DecodeLatin1(s.data(), s.length());
|
py::handle py_s = PyUnicode_DecodeLatin1(s.data(), s.length(), nullptr);
|
||||||
return py_s;
|
if (!py_s) {
|
||||||
|
throw py::error_already_set();
|
||||||
|
}
|
||||||
|
return py::reinterpret_steal<py::str>(py_s);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -113,7 +116,8 @@ conversion has the same overhead as implicit conversion.
|
|||||||
|
|
||||||
The `Python C API
|
The `Python C API
|
||||||
<https://docs.python.org/3/c-api/unicode.html#built-in-codecs>`_ provides
|
<https://docs.python.org/3/c-api/unicode.html#built-in-codecs>`_ provides
|
||||||
several built-in codecs.
|
several built-in codecs. Note that these all return *new* references, so
|
||||||
|
use :cpp:func:`reinterpret_steal` when converting them to a :cpp:class:`str`.
|
||||||
|
|
||||||
|
|
||||||
One could also use a third party encoding library such as libiconv to transcode
|
One could also use a third party encoding library such as libiconv to transcode
|
||||||
|
Loading…
Reference in New Issue
Block a user