"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer1/PConv.cpp" between
pymol-v1.8.6.0.tar.bz2 and pymol-v2.1.0.tar.bz2

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

PConv.cpp  (pymol-v1.8.6.0.tar.bz2):PConv.cpp  (pymol-v2.1.0.tar.bz2)
skipping to change at line 37 skipping to change at line 37
#include"PConv.h" #include"PConv.h"
#include"P.h" #include"P.h"
#include"Util.h" #include"Util.h"
#include <vector> #include <vector>
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
#define pickle_mod_name "pickle" #define pickle_mod_name "pickle"
#else #else
#define pickle_mod_name "cPickle" #define pickle_mod_name "cPickle"
// support loading Python 3 pickles with Python 2
#define PyString_Check(o) (PyBytes_CheckExact(o) || PyUnicode_Check(o))
#endif #endif
/* Return value: New reference. /* Return value: New reference.
* Load a pickle from the given string * Load a pickle from the given string
*/ */
PyObject *PConvPickleLoads(PyObject * str) PyObject *PConvPickleLoads(PyObject * str)
{ {
PyObject *picklemod = NULL, *obj = NULL; PyObject *picklemod = NULL, *obj = NULL;
ok_assert(1, picklemod = PyImport_ImportModule(pickle_mod_name)); ok_assert(1, picklemod = PyImport_ImportModule(pickle_mod_name));
obj = PYOBJECT_CALLMETHOD(picklemod, "loads", "O", str); obj = PYOBJECT_CALLMETHOD(picklemod, "loads", "O", str);
skipping to change at line 245 skipping to change at line 247
*lex_ref = result.word; *lex_ref = result.word;
} else { } else {
ok = false; ok = false;
} }
} }
} }
return ok; return ok;
} }
#ifndef _PYMOL_NOPY #ifndef _PYMOL_NOPY
int PConvPyStrToStrPtr(PyObject * obj, char **ptr) int PConvPyStrToStrPtr(PyObject * obj, const char **ptr)
{ {
int ok = true; int ok = true;
if(!obj) { if(!obj) {
ok = false; ok = false;
} else if(!PyString_Check(obj)) { } else if(!PyString_Check(obj)) {
ok = false; ok = false;
} }
if(ok) if(ok)
*ptr = PyString_AsString(obj); *ptr = PyString_AsString(obj);
return (ok); return (ok);
skipping to change at line 393 skipping to change at line 395
} else } else
result = false; result = false;
} }
return (result); return (result);
} }
int PConvPyObjectToStrMaxLen(PyObject * object, char *value, int ln) int PConvPyObjectToStrMaxLen(PyObject * object, char *value, int ln)
{ {
PyObject *tmp; PyObject *tmp;
int result = true; int result = true;
if(!object) if(!object) {
result = false; result = false;
else if(PyString_Check(object)) { #if PY_MAJOR_VERSION >= 3
} else if(PyBytes_Check(object)) {
auto strval = PyBytes_AsSomeString(object);
strncpy(value, strval.c_str(), ln);
#endif
} else if(PyString_Check(object)) {
auto strval = PyString_AsSomeString(object); auto strval = PyString_AsSomeString(object);
strncpy(value, strval.c_str(), ln); strncpy(value, strval.c_str(), ln);
} else { } else {
tmp = PyObject_Str(object); tmp = PyObject_Str(object);
if(tmp) { if(tmp) {
auto strval = PyString_AsSomeString(tmp); auto strval = PyString_AsSomeString(tmp);
strncpy(value, strval.c_str(), ln); strncpy(value, strval.c_str(), ln);
Py_DECREF(tmp); Py_DECREF(tmp);
} else } else
result = 0; result = 0;
 End of changes. 4 change blocks. 
3 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)