~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_static_tuple_c.c

  • Committer: Andrew Bennetts
  • Date: 2010-01-13 23:16:20 UTC
  • mfrom: (4957 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4960.
  • Revision ID: andrew.bennetts@canonical.com-20100113231620-n6in2yjib2v6z03g
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2009, 2010 Canonical Ltd
 
1
/* Copyright (C) 2009 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
    }
143
147
 
144
148
    if (size < 0 || size > 255) {
145
149
        /* Too big or too small */
276
280
        return NULL;
277
281
    }
278
282
    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
 
    }
287
283
    self = (StaticTuple *)StaticTuple_New(len);
288
284
    if (self == NULL) {
289
285
        return NULL;