mirror of https://github.com/KLayout/klayout.git
[consider merging] Avoids an assertion when using tuples for out vector parameters
This commit is contained in:
parent
38d7d34642
commit
b2b950041d
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "gsi.h"
|
||||
#include "gsiSerialisation.h"
|
||||
#include "tlLog.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
@ -38,7 +39,14 @@ public:
|
|||
|
||||
~AdaptorSynchronizer ()
|
||||
{
|
||||
mp_src->copy_to (mp_target, *mp_heap);
|
||||
try {
|
||||
// NOTE: exceptions must not escape destructors as a basic C++ design requirement
|
||||
mp_src->copy_to (mp_target, *mp_heap);
|
||||
} catch (tl::Exception &ex) {
|
||||
tl::error << ex.msg ();
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
delete mp_src;
|
||||
delete mp_target;
|
||||
mp_src = 0;
|
||||
|
|
|
|||
|
|
@ -928,8 +928,10 @@ void PythonBasedVectorAdaptor::push (gsi::SerialArgs &r, tl::Heap &heap)
|
|||
|
||||
void PythonBasedVectorAdaptor::clear ()
|
||||
{
|
||||
if (PySequence_Check (m_array.get ())) {
|
||||
PySequence_DelSlice (m_array.get (), 0, PySequence_Length (m_array.get ()));
|
||||
if (PyList_Check (m_array.get ())) {
|
||||
PyList_SetSlice (m_array.get (), 0, PyList_Size (m_array.get ()), NULL);
|
||||
} else if (PyTuple_Check (m_array.get ())) {
|
||||
throw tl::Exception (tl::to_string (tr ("Tuples cannot be modified and cannot be used as out parameters")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue