view oct-py-types.h @ 328:5782d7932529

Automatically convert Python 2 'int' type to Octave int64 (fixes issue #56) * oct-py-types.cc, oct-py-types.h (pytave::extract_py_int64): New function. * python_to_octave.cc (pytave::pyobj_to_octvalue): Convert Python 2 'int' to Octave int64 type. * @py/py.m, pycall.cc: Add %!tests for Python 'int' and 'long' type handling, conditional on Python version.
author Mike Miller <mtmiller@octave.org>
date Sat, 13 Aug 2016 23:52:57 -0700
parents fd5881d48238
children c081e30c2f64
line wrap: on
line source

/*

Copyright (C) 2016 Mike Miller

This file is part of Pytave.

Pytave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

Pytave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with Pytave; see the file COPYING.  If not, see
<http://www.gnu.org/licenses/>.

*/

#if ! defined (pytave_oct_py_types_h)
#define pytave_oct_py_types_h 1

#include <Python.h>
#include <string>

class octave_scalar_map;

namespace pytave
{

PyObject *
make_py_dict (const octave_scalar_map& map);

int64_t
extract_py_int64 (PyObject *obj);

std::string
extract_py_str (PyObject *obj);

PyObject *
make_py_str (const std::string& str);

}

#endif