Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11_abseil
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11_abseil
Commits
429ae15d
Commit
429ae15d
authored
Mar 29, 2023
by
Xiaofei Wang
Committed by
Copybara-Service
Mar 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show a different error message when loading Python None as StatusOr<T>.
PiperOrigin-RevId: 520495543
parent
59827596
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
+5
-1
pybind11_abseil/statusor_caster.h
+4
-0
pybind11_abseil/tests/status_example_test.py
+1
-1
No files found.
pybind11_abseil/statusor_caster.h
View file @
429ae15d
...
...
@@ -50,6 +50,10 @@ struct type_caster<absl::StatusOr<PayloadType>> {
value
=
cast_op
<
PayloadType
>
(
std
::
move
(
payload_caster
));
return
true
;
}
if
(
src
.
is_none
())
{
throw
cast_error
(
"None is not a valid value for a StatusOr<T> argument."
);
}
StatusCaster
status_caster
;
if
(
status_caster
.
load
(
src
,
convert
))
{
absl
::
Status
status
=
cast_op
<
absl
::
Status
>
(
std
::
move
(
status_caster
));
...
...
pybind11_abseil/tests/status_example_test.py
View file @
429ae15d
...
...
@@ -57,7 +57,7 @@ class StatusTest(parameterized.TestCase):
status_example
.
check_statusor
(
None
,
status
.
StatusCode
.
CANCELLED
)
self
.
assertEqual
(
str
(
ctx
.
exception
),
'
An OK status is not a valid constructor argument to StatusOr<T>
.'
)
'
None is not a valid value for a StatusOr<T> argument
.'
)
def
test_return_status_return_type_from_doc
(
self
):
self
.
assertEndsWith
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment