Ticket #4841: patch

File patch, 1.8 KB (added by Eric Pettersen, 4 years ago)
  • src/bundles/atomic/atomic_cpp/molc.cpp

    diff --git a/src/bundles/atomic/atomic_cpp/molc.cpp b/src/bundles/atomic/atomic_cpp/molc.cpp
    index f6850da98..272656e26 100755
    a b extern "C" EXPORT PyObject *atom_idatm_info_map()  
    829829                disable = enable = NULL;
    830830                std::cerr << "Can't control garbage collection\n";
    831831            }
    832             if (disable) Py_XDECREF(PyEval_CallObject(disable, NULL));
     832            if (disable) Py_XDECREF(PyObject_CallNoArgs(disable));
    833833            auto type_obj = PyStructSequence_NewType(&type_desc);
    834834            // As per https://bugs.python.org/issue20066 and https://bugs.python.org/issue15729,
    835835            // the type object isn't completely initialized, so...
    extern "C" EXPORT PyObject *atom_idatm_info_map()  
    848848                Py_DECREF(key);
    849849                Py_DECREF(val);
    850850            }
    851             if (enable) Py_XDECREF(PyEval_CallObject(enable, NULL));
     851            if (enable) Py_XDECREF(PyObject_CallNoArgs(enable));
    852852        } catch (...) {
    853853            molc_error();
    854854        }
    extern "C" EXPORT void set_residue_insertion_code(void *residues, size_t n, pyob  
    27472747    try {
    27482748        for (size_t i = 0; i != n; ++i) {
    27492749            PyObject* py_ic = static_cast<PyObject*>(ics[i]);
    2750             auto size = PyUnicode_GET_DATA_SIZE(py_ic);
     2750            auto size = PyUnicode_GET_LENGTH(py_ic);
    27512751            if (size > 1)
    27522752                throw std::invalid_argument("Insertion code must be one character or empty string");
    27532753            char val;
    27542754            if (size == 0)
    27552755                val = ' ';
    27562756            else
    2757                 val = PyUnicode_AS_DATA(py_ic)[0];
     2757                val = (char)PyUnicode_READ_CHAR(py_ic, 0);
    27582758            r[i]->set_insertion_code(val);
    27592759        }
    27602760    } catch (...) {