Commit d3927eb
committed
PYCBC-1852: Raise on invalid int-enum values instead of default
Changes
--------
* In cpp_core_enum_conversion_macros.hxx, check PyErr_Occurred()
after PyLong_AsUnsignedLong() in both PYCBC_DEFINE_INT_ENUM_CONVERSION
and PYCBC_DEFINE_INT16_ENUM_CONVERSION
* On a negative or out-of-range Python int, clear the pending
OverflowError and throw std::invalid_argument instead of casting
the -1 error sentinel and silently falling through to the enum's
default value
Change-Id: I6079b6f7d401ee58d738bccc2acda925ae9c3406
Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/250617
Reviewed-by: Dimitris Christodoulou <dimitris.christodoulou@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>1 parent 03e5424 commit d3927eb
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
| |||
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
133 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
134 | 146 | | |
135 | 147 | | |
136 | 148 | | |
| |||
0 commit comments