Skip to content

Commit

Permalink
Merge a8b445b into 6d7a15b
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshilov committed Dec 31, 2018
2 parents 6d7a15b + a8b445b commit 84bead0
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 40 deletions.
2 changes: 1 addition & 1 deletion pygraphviz/graphviz.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern PyTypeObject PyIOBase_Type;
}
%#endif
mode_obj = PyObject_GetAttrString($input, "mode");
%#if !defined(PYPY_VERSION)
%#if PY_VERSION_HEX >= 0x03000000
mode_byte_obj = PyUnicode_AsUTF8String(mode_obj);
%#else
mode_byte_obj = mode_obj;
Expand Down
4 changes: 2 additions & 2 deletions pygraphviz/graphviz.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
Expand Down Expand Up @@ -77,7 +77,7 @@ def _swig_getattr(self, class_type, name):
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except:
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

Expand Down
117 changes: 80 additions & 37 deletions pygraphviz/graphviz_wrap.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.7
* Version 3.0.8
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */


#ifndef SWIGPYTHON
#define SWIGPYTHON
#endif

#define SWIG_PYTHON_DIRECTOR_NO_VTABLE

/* -----------------------------------------------------------------------------
Expand Down Expand Up @@ -1301,7 +1305,7 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {

/* Unpack the argument tuple */

SWIGINTERN int
SWIGINTERN Py_ssize_t
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
{
if (!args) {
Expand All @@ -1315,7 +1319,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
}
if (!PyTuple_Check(args)) {
if (min <= 1 && max >= 1) {
int i;
Py_ssize_t i;
objs[0] = args;
for (i = 1; i < max; ++i) {
objs[i] = 0;
Expand All @@ -1335,7 +1339,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
name, (min == max ? "" : "at most "), (int)max, (int)l);
return 0;
} else {
int i;
Py_ssize_t i;
for (i = 0; i < l; ++i) {
objs[i] = PyTuple_GET_ITEM(args, i);
}
Expand Down Expand Up @@ -1676,16 +1680,32 @@ SwigPyObject_dealloc(PyObject *v)
if (destroy) {
/* destroy is always a VARARGS method */
PyObject *res;

/* PyObject_CallFunction() has the potential to silently drop
the active active exception. In cases of unnamed temporary
variable or where we just finished iterating over a generator
StopIteration will be active right now, and this needs to
remain true upon return from SwigPyObject_dealloc. So save
and restore. */

PyObject *val = NULL, *type = NULL, *tb = NULL;
PyErr_Fetch(&val, &type, &tb);

if (data->delargs) {
/* we need to create a temporary object to carry the destroy operation */
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
res = SWIG_Python_CallFunctor(destroy, tmp);
Py_DECREF(tmp);
/* we need to create a temporary object to carry the destroy operation */
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
res = SWIG_Python_CallFunctor(destroy, tmp);
Py_DECREF(tmp);
} else {
PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
PyObject *mself = PyCFunction_GET_SELF(destroy);
res = ((*meth)(mself, v));
PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
PyObject *mself = PyCFunction_GET_SELF(destroy);
res = ((*meth)(mself, v));
}
if (!res)
PyErr_WriteUnraisable(destroy);

PyErr_Restore(val, type, tb);

Py_XDECREF(res);
}
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
Expand All @@ -1709,6 +1729,7 @@ SwigPyObject_append(PyObject* v, PyObject* next)
next = tmp;
#endif
if (!SwigPyObject_Check(next)) {
PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
return NULL;
}
sobj->next = next;
Expand Down Expand Up @@ -1864,7 +1885,9 @@ SwigPyObject_TypeOnce(void) {
(unaryfunc)SwigPyObject_oct, /*nb_oct*/
(unaryfunc)SwigPyObject_hex, /*nb_hex*/
#endif
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
Expand Down Expand Up @@ -1944,10 +1967,19 @@ SwigPyObject_TypeOnce(void) {
0, /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version */
0, /* tp_version_tag */
#endif
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
#ifdef COUNT_ALLOCS
0,0,0,0 /* tp_alloc -> tp_next */
0, /* tp_allocs */
0, /* tp_frees */
0, /* tp_maxalloc */
#if PY_VERSION_HEX >= 0x02050000
0, /* tp_prev */
#endif
0 /* tp_next */
#endif
};
swigpyobject_type = tmp;
Expand Down Expand Up @@ -2123,10 +2155,19 @@ SwigPyPacked_TypeOnce(void) {
0, /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version */
0, /* tp_version_tag */
#endif
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
#ifdef COUNT_ALLOCS
0,0,0,0 /* tp_alloc -> tp_next */
0, /* tp_allocs */
0, /* tp_frees */
0, /* tp_maxalloc */
#if PY_VERSION_HEX >= 0x02050000
0, /* tp_prev */
#endif
0 /* tp_next */
#endif
};
swigpypacked_type = tmp;
Expand Down Expand Up @@ -2654,13 +2695,11 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
{
PyObject *dict;
if (!PyModule_Check(m)) {
PyErr_SetString(PyExc_TypeError,
"PyModule_AddObject() needs module as first arg");
PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
return SWIG_ERROR;
}
if (!o) {
PyErr_SetString(PyExc_TypeError,
"PyModule_AddObject() needs non-NULL value");
PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
return SWIG_ERROR;
}

Expand Down Expand Up @@ -2976,7 +3015,7 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
#endif
#define SWIG_name "_graphviz"

#define SWIGVERSION 0x030007
#define SWIGVERSION 0x030008
#define SWIG_VERSION SWIGVERSION


Expand Down Expand Up @@ -3094,9 +3133,11 @@ SWIG_AsVal_double (PyObject *obj, double *val)
if (PyFloat_Check(obj)) {
if (val) *val = PyFloat_AsDouble(obj);
return SWIG_OK;
#if PY_VERSION_HEX < 0x03000000
} else if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return SWIG_OK;
#endif
} else if (PyLong_Check(obj)) {
double v = PyLong_AsDouble(obj);
if (!PyErr_Occurred()) {
Expand Down Expand Up @@ -3170,16 +3211,20 @@ SWIG_CanCastAsInteger(double *d, double min, double max) {
SWIGINTERN int
SWIG_AsVal_long (PyObject *obj, long* val)
{
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return SWIG_OK;
} else if (PyLong_Check(obj)) {
} else
#endif
if (PyLong_Check(obj)) {
long v = PyLong_AsLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_OK;
} else {
PyErr_Clear();
return SWIG_OverflowError;
}
}
#ifdef SWIG_PYTHON_CAST_MODE
Expand Down Expand Up @@ -3243,18 +3288,7 @@ SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
return SWIG_OK;
} else {
PyErr_Clear();
#if PY_VERSION_HEX >= 0x03000000
{
long v = PyLong_AsLong(obj);
if (!PyErr_Occurred()) {
if (v < 0) {
return SWIG_OverflowError;
}
} else {
PyErr_Clear();
}
}
#endif
return SWIG_OverflowError;
}
}
#ifdef SWIG_PYTHON_CAST_MODE
Expand Down Expand Up @@ -3463,7 +3497,7 @@ SWIGINTERN PyObject *_wrap_agread(PyObject *SWIGUNUSEDPARM(self), PyObject *args
}
#endif
mode_obj1 = PyObject_GetAttrString(obj0, "mode");
#if !defined(PYPY_VERSION)
#if PY_VERSION_HEX >= 0x03000000
mode_byte_obj1 = PyUnicode_AsUTF8String(mode_obj1);
#else
mode_byte_obj1 = mode_obj1;
Expand Down Expand Up @@ -5783,10 +5817,19 @@ extern "C" {
0, /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version */
0, /* tp_version_tag */
#endif
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
#ifdef COUNT_ALLOCS
0,0,0,0 /* tp_alloc -> tp_next */
0, /* tp_allocs */
0, /* tp_frees */
0, /* tp_maxalloc */
#if PY_VERSION_HEX >= 0x02050000
0, /* tp_prev */
#endif
0 /* tp_next */
#endif
};
varlink_type = tmp;
Expand Down

0 comments on commit 84bead0

Please sign in to comment.