search for: pylong_aslonglong

Displaying 7 results from an estimated 7 matches for "pylong_aslonglong".

2003 Dec 09
3
Interfacing R and Python in MS Windows
Hi all, I need the power of R from within some of my Python programs... I use debian linux (woody) at home and windows XP at work (the latter is where I need to get things done!) This are my packages: R 1.8.0 Python 2.3 RSPython 0.5-3 This is what I've done: (1) Since the Windows Binary of RSPython is compiled against Python 2.2 I downloaded the tarball (2) Followed the instructions in
2012 Sep 20
0
[PATCH] python: PyInt_* no longer exists in python3, replace with PyLong_*
...pr " optargs_s.%s = PyInt_AsLong (py_%s);\n" n n; + pr " optargs_s.%s = PyLong_AsLong (py_%s);\n" n n; pr " if (PyErr_Occurred ()) return NULL;\n" | OInt64 _ -> pr " optargs_s.%s = PyLong_AsLongLong (py_%s);\n" n n; -- 1.7.10.4
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...uot; guestfs_int_py_fromstringsize (&%s->%s, 1));\n" + typ name ) cols; pr " return dict;\n"; pr "};\n"; @@ -419,13 +401,7 @@ and generate_python_actions actions () = pr " optargs_s.%s = PyLong_AsLongLong (py_%s);\n" n n; pr " if (PyErr_Occurred ()) goto out;\n" | OString _ -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " optargs_s.%s = PyString_AsString (py_%s);\n" n n; - pr "#else\n...
2014 Aug 08
2
[PATCH 1/2] Add type checking, support integers as value
...turn -1; + } + + ret->len = sizeof (d); + ret->value = (char *) word; + if (ret->t == hive_t_REG_DWORD) + *(uint32_t *) ret->value = htole32 (d); + else + *(uint32_t *) ret->value = htobe32 (d); + } else if (ret->t == hive_t_REG_QWORD) { + uint64_t l = PyLong_AsLongLong (obj); + if (PyErr_Occurred ()) { + PyErr_SetString (PyExc_TypeError, \"expected int type for QWORD value\"); + return -1; + } + + ret->len = sizeof (l); + ret->value = (char *) word; + *(uint64_t *) ret->value = htole64 (l); + } else { + PyErr_SetStr...
2017 May 09
0
[PATCH] python: add simple wrappers for PyObject<->string functions
...uot; guestfs_int_py_fromstringsize (&%s->%s, 1));\n" + typ name ) cols; pr " return dict;\n"; pr "};\n"; @@ -419,13 +401,7 @@ and generate_python_actions actions () = pr " optargs_s.%s = PyLong_AsLongLong (py_%s);\n" n n; pr " if (PyErr_Occurred ()) goto out;\n" | OString _ -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " optargs_s.%s = PyString_AsString (py_%s);\n" n n; - pr "#else\n...
2014 Aug 04
6
[hivex] Segfault for an integer value to node_set_value
Hi, When an integer argument is passed as value, node_set_value segfaults. Reproducer is at the end of this message The backtrace points at hivex-py.c, function get_value. While obj is non-NULL, `bytes = PyUnicode_AsUTF8String (obj);` returns NULL. Kind regards, Peter https://lekensteyn.nl #!/usr/bin/env python3 import hivex, sys h = hivex.Hivex(sys.argv[1]) print(h) val = {
2010 Sep 09
2
[PATCH]: add libxl python binding
...0; +} + +PyObject *genwrap__ll_get(long long val) +{ + return PyLong_FromLongLong(val); +} + +int genwrap__ll_set(PyObject *v, long long *val, long long mask) +{ + long long tmp; + if ( NULL == v ) { + *val = 0; + return 0; + } + if ( PyLong_Check(v) ) { + tmp = PyLong_AsLongLong(v); + }else{ + tmp = (long long)PyInt_AsLong(v); + } + if ( tmp & ~mask ) { + PyErr_SetString(PyExc_ValueError, "Integer overflow"); + return -1; + } + *val = tmp; + return 0; +} + +""" % tuple((" ".join(sys.argv),) + (os...