~ubuntu-branches/ubuntu/saucy/python2.7/saucy-updates

« back to all changes in this revision

Viewing changes to Python/ast.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-03-23 19:56:03 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20130323195603-ftu05fam0tvkpkro
Tags: 2.7.4~rc1-0ubuntu1
* Python 2.7.4 release candidate 1.
  - Issue #10211: Buffer objects expose the new buffer interface internally.
  - Issue #10212: cStringIO and struct.unpack support new buffer objects.
  - Issue #12098: multiprocessing on Windows now starts child processes
    using the same sys.flags as the current process.
  - Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
  - Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or
    EAGAIN, retry the select() loop instead of bailing out.
  - Issue #1285086: Get rid of the refcounting hack and speed up
    urllib.unquote().
  - Issue #17368: Fix an off-by-one error in the Python JSON decoder
    that caused a failure while decoding empty object literals when
    object_pairs_hook was specified.
  - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
    db-5.x, and dropping support for db-4.1 and db-4.2.
  - Issue #17192: Update the ctypes module's libffi to v3.0.13.  This
    specifically addresses a stack misalignment issue on x86 and issues on
    some more recent platforms.
  - Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set.
  - Issue #17299: Add test coverage for cPickle with file objects
    and general IO objects.
  - Issue #11963: remove human verification from test_parser and
    test_subprocess.
  - Issue #16004: Add `make touch`.
  - Issue #17047: remove doubled words in docs and docstrings
* Rework the sysconfigdata patch into something upstreamable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
930
930
      return NULL;
931
931
 
932
932
    assert(TYPE(CHILD(n, 1)) == funcdef ||
933
 
           TYPE(CHILD(n, 1)) == classdef);
 
933
           TYPE(CHILD(n, 1)) == classdef);
934
934
 
935
935
    if (TYPE(CHILD(n, 1)) == funcdef) {
936
936
      thing = ast_for_funcdef(c, CHILD(n, 1), decorator_seq);
1744
1744
        NCH(ppower) == 1 &&
1745
1745
        TYPE((patom = CHILD(ppower, 0))) == atom &&
1746
1746
        TYPE((pnum = CHILD(patom, 0))) == NUMBER) {
 
1747
        PyObject *pynum;
1747
1748
        char *s = PyObject_MALLOC(strlen(STR(pnum)) + 2);
1748
1749
        if (s == NULL)
1749
1750
            return NULL;
1750
1751
        s[0] = '-';
1751
1752
        strcpy(s + 1, STR(pnum));
1752
 
        PyObject_FREE(STR(pnum));
1753
 
        STR(pnum) = s;
1754
 
        return ast_for_atom(c, patom);
 
1753
        pynum = parsenumber(c, s);
 
1754
        PyObject_FREE(s);
 
1755
        if (!pynum)
 
1756
            return NULL;
 
1757
 
 
1758
        PyArena_AddPyObject(c->c_arena, pynum);
 
1759
        return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena);
1755
1760
    }
1756
1761
 
1757
1762
    expression = ast_for_expr(c, CHILD(n, 1));
3292
3297
                return ast_for_funcdef(c, ch, NULL);
3293
3298
            case classdef:
3294
3299
                return ast_for_classdef(c, ch, NULL);
3295
 
            case decorated:
3296
 
                return ast_for_decorated(c, ch);
 
3300
            case decorated:
 
3301
                return ast_for_decorated(c, ch);
3297
3302
            default:
3298
3303
                PyErr_Format(PyExc_SystemError,
3299
3304
                             "unhandled small_stmt: TYPE=%d NCH=%d\n",
3382
3387
                /* check for integer overflow */
3383
3388
                if (len > PY_SIZE_MAX / 6)
3384
3389
                        return NULL;
3385
 
                /* "<C3><A4>" (2 bytes) may become "\U000000E4" (10 bytes), or 1:5
3386
 
                   "\ä" (3 bytes) may become "\u005c\U000000E4" (16 bytes), or ~1:6 */
 
3390
                /* "<C3><A4>" (2 bytes) may become "\U000000E4" (10 bytes), or 1:5
 
3391
                   "\ä" (3 bytes) may become "\u005c\U000000E4" (16 bytes), or ~1:6 */
3387
3392
                u = PyString_FromStringAndSize((char *)NULL, len * 6);
3388
3393
                if (u == NULL)
3389
3394
                        return NULL;
3413
3418
                                        sprintf(p, "\\U%02x%02x%02x%02x",
3414
3419
                                                r[i + 0] & 0xFF,
3415
3420
                                                r[i + 1] & 0xFF,
3416
 
                                                r[i + 2] & 0xFF,
3417
 
                                                r[i + 3] & 0xFF);
 
3421
                                                r[i + 2] & 0xFF,
 
3422
                                                r[i + 3] & 0xFF);
3418
3423
                                        p += 10;
3419
3424
                                }
3420
3425
                                Py_DECREF(w);