Skip to content

Commit cbae130

Browse files
committed
reverting last change, abort is necessary even in production code
1 parent 8c0f521 commit cbae130

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/python/serialization_suite.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ class python_bytes_sink : public iostreams::sink {
3838
std::streamsize write(const char* s, std::streamsize n) {
3939
if (len_ == 0) {
4040
*pstr_ = PyBytes_FromStringAndSize(s, n);
41-
// no point trying to recover from allocation error
42-
BOOST_ASSERT(*pstr_ != 0);
41+
if (*pstr_ == 0) // no point trying to recover from allocation error
42+
std::abort();
4343
len_ = n;
4444
} else {
4545
if (pos_ + n > len_) {
4646
len_ = pos_ + n;
47-
auto err_code = _PyBytes_Resize(pstr_, len_);
48-
// no point trying to recover from allocation error
49-
BOOST_ASSERT(err_code != -1);
47+
if (_PyBytes_Resize(pstr_, len_) == -1)
48+
std::abort(); // no point trying to recover from allocation error
5049
}
5150
char* b = PyBytes_AS_STRING(*pstr_);
5251
std::copy(s, s + n, b + pos_);

0 commit comments

Comments
 (0)