Staging
v0.8.1
https://github.com/python/cpython
Revision d642734d7f00bac67c655ea704102058b838b2d5 authored by Philip Jenvey on 28 May 2009, 03:16:05 UTC, committed by Philip Jenvey on 28 May 2009, 03:16:05 UTC
........
  r72972 | philip.jenvey | 2009-05-27 20:10:59 -0700 (Wed, 27 May 2009) | 2 lines

  explicitly close the file, merged from py3k
........
  r72973 | philip.jenvey | 2009-05-27 20:12:16 -0700 (Wed, 27 May 2009) | 2 lines

  further hint to where the open docs really are
........
1 parent 87c50b4
Raw File
Tip revision: d642734d7f00bac67c655ea704102058b838b2d5 authored by Philip Jenvey on 28 May 2009, 03:16:05 UTC
Blocked revisions 72972-72973 via svnmerge
Tip revision: d642734
hashlib.h
/* Common code for use by all hashlib related modules. */

/*
 * Given a PyObject* obj, fill in the Py_buffer* viewp with the result
 * of PyObject_GetBuffer.  Sets and exception and issues a return NULL
 * on any errors.
 */
#define GET_BUFFER_VIEW_OR_ERROUT(obj, viewp) do { \
        if (PyUnicode_Check((obj))) { \
            PyErr_SetString(PyExc_TypeError, \
                            "Unicode-objects must be encoded before hashing");\
            return NULL; \
        } \
        if (!PyObject_CheckBuffer((obj))) { \
            PyErr_SetString(PyExc_TypeError, \
                            "object supporting the buffer API required"); \
            return NULL; \
        } \
        if (PyObject_GetBuffer((obj), (viewp), PyBUF_SIMPLE) == -1) { \
            return NULL; \
        } \
        if ((viewp)->ndim > 1) { \
            PyErr_SetString(PyExc_BufferError, \
                            "Buffer must be single dimension"); \
            PyBuffer_Release((viewp)); \
            return NULL; \
        } \
    } while(0);
back to top