~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_static_tuple_c.c

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2009 Canonical Ltd
 
1
/* Copyright (C) 2009, 2010 Canonical Ltd
2
2
 * 
3
3
 * This program is free software; you can redistribute it and/or modify
4
4
 * it under the terms of the GNU General Public License as published by
140
140
StaticTuple_New(Py_ssize_t size)
141
141
{
142
142
    StaticTuple *stuple;
143
 
    if (size < 0) {
144
 
        PyErr_BadInternalCall();
145
 
        return NULL;
146
 
    }
147
143
 
148
144
    if (size < 0 || size > 255) {
149
145
        /* Too big or too small */
280
276
        return NULL;
281
277
    }
282
278
    len = PyTuple_GET_SIZE(args);
 
279
    if (len < 0 || len > 255) {
 
280
        /* Check the length here so we can raise a TypeError instead of
 
281
         * StaticTuple_New's ValueError.
 
282
         */
 
283
        PyErr_SetString(PyExc_TypeError, "StaticTuple(...)"
 
284
            " takes from 0 to 255 items");
 
285
        return NULL;
 
286
    }
283
287
    self = (StaticTuple *)StaticTuple_New(len);
284
288
    if (self == NULL) {
285
289
        return NULL;