Commit Graph

1180 Commits

Author SHA1 Message Date
Anthony Baxter c7403ed183 Add a clause to the PY_FORMAT_SIZE_T to stop warnings on 32 bit intel
linux with gcc 4.0.2, after talking to Tim.
  <ymmit> But it won't break anything anywhere, so don't worry :-)
2006-04-01 01:08:29 +00:00
Barry Warsaw 176014ffad SF patch #1458476 with modifications based on discussions in python-dev. This
adds the following API calls: PySet_Clear(), _PySet_Next(), and
_PySet_Update().  The latter two are considered non-public.  Tests and
documentation (for the public API) are included.
2006-03-30 22:45:35 +00:00
Tim Peters c9d78aa470 Years in the making.
objimpl.h, pymem.h:  Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE}
to PyObject_{Free, FREE} in a release build.  They're aliases for the
system free() now.

_subprocess.c/sp_handle_dealloc():  Since the memory was originally
obtained via PyObject_NEW, it must be released via PyObject_FREE (or
_DEL).

pythonrun.c, tokenizer.c, parsermodule.c:  I lost count of the number of
PyObject vs PyMem mismatches in these -- it's like the specific
function called at each site was picked at random, sometimes even with
memory obtained via PyMem getting released via PyObject.  Changed most
to use PyObject uniformly, since the blobs allocated are predictably
small in most cases, and obmalloc is generally faster than system
mallocs then.

If extension modules in real life prove as sloppy as Python's front
end, we'll have to revert the objimpl.h + pymem.h part of this patch.
Note that no problems will show up in a debug build (all calls still go
thru obmalloc then). Problems will show up only in a release build, most
likely segfaults.
2006-03-26 23:27:58 +00:00
Neal Norwitz badc086543 Stop duplicating code and handle slice indices consistently and correctly
wrt to ssize_t.
2006-03-23 06:03:08 +00:00
Hye-Shik Chang f303261cf0 Remove false information from the comment and reformat it like other
comments in the file. (SF #1455641)
2006-03-22 08:52:43 +00:00
Neal Norwitz 3dd8be414e Get Py_DEPRECATED to work with gcc 4.x too 2006-03-20 06:33:01 +00:00
Tim Peters ae1d0c978d Introduced symbol PY_FORMAT_SIZE_T. See the new comments
in pyport.h.  Changed PyString_FromFormatV() to use it
instead of inlining its own maze of #if'ery.
2006-03-17 03:29:34 +00:00
Walter Dörwald abb02e5994 Patch #1436130: codecs.lookup() now returns a CodecInfo object (a subclass
of tuple) that provides incremental decoders and encoders (a way to use
stateful codecs without the stream API). Functions
codecs.getincrementaldecoder() and codecs.getincrementalencoder() have
been added.
2006-03-15 11:35:15 +00:00
Martin v. Löwis 5bd7c02298 Avoid forward-declaring the methods array.
Rename unicodedata.db* to unicodedata.ucd*
2006-03-10 11:20:04 +00:00
Martin v. Löwis 480f1bb67b Update Unicode database to Unicode 4.1. 2006-03-09 23:38:20 +00:00
Guido van Rossum 38fff8c4e4 Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
2006-03-07 18:50:55 +00:00
Neal Norwitz 7b216c52e4 Make PyGC_Collect() use Py_ssize_t. 2006-03-04 20:01:53 +00:00
Neal Norwitz 4281cef205 Use Py_ssize_t for _Py_RefTotal.
I tried to handle Win64 properly, but please review.
2006-03-04 19:58:13 +00:00
Neal Norwitz 1fc4b776d4 Change some sequnce APIs to use Py_ssize_t. 2006-03-04 18:49:58 +00:00
Neal Norwitz 8c49c82889 Use Py_ssize_t for PySet_Size() like all the other Py*_Size() functions. 2006-03-04 18:41:19 +00:00
Tim Peters 6fd92dc44f Added words about what PyArena_Malloc() does. 2006-03-02 21:14:45 +00:00
Tim Peters cb9426b5f4 Beefed up description of what this does; new XXX. 2006-03-02 21:04:08 +00:00
Tim Peters 5f4390fb09 New XXX pointing out errors in the description of
PyArena_New(); unsure what the intent is.
2006-03-02 20:48:25 +00:00
Tim Peters 8cfaa0e729 Trimmed trailing whitespace. 2006-03-02 20:37:32 +00:00
Martin v. Löwis 49c5da1d88 Patch #1440601: Add col_offset attribute to AST nodes. 2006-03-01 22:49:05 +00:00
Martin v. Löwis 6db0e00d57 Change GC refcount to Py_ssize_t. 2006-03-01 16:56:25 +00:00
Martin v. Löwis 056a69cba6 Reconst parameters that lost their const in the AST merge. 2006-03-01 16:55:42 +00:00
Brett Cannon bf36409e2a PEP 352 implementation. Creates a new base class, BaseException, which has an
added message attribute compared to the previous version of Exception.  It is
also a new-style class, making all exceptions now new-style.  KeyboardInterrupt
and SystemExit inherit from BaseException directly.  String exceptions now
raise DeprecationWarning.

Applies patch 1104669, and closes bugs 1012952 and 518846.
2006-03-01 04:25:17 +00:00
Martin v. Löwis 762467475d Use Py_ssize_t for PyArg_UnpackTuple arguments. 2006-03-01 04:06:10 +00:00
Martin v. Löwis e36dce69dd Make ob_refcnt and tp_maxalloc (and friends) Py_ssize_t. 2006-03-01 04:02:43 +00:00
Thomas Wouters ca82a8b760 Move #include to outside "extern C {}", before Tim figures out it'll break
VC++.
2006-02-28 23:09:08 +00:00
Thomas Wouters e4d3a72ab8 Include code.h more sanely. 2006-02-28 22:40:55 +00:00
Neal Norwitz 090b3dde06 No need to export PySTEntry_New, it is only used in symtable.c 2006-02-28 22:36:46 +00:00
Neal Norwitz e42e405e08 Martin owns PEP 353 and did most of the work 2006-02-28 20:03:28 +00:00
Thomas Wouters 34aa7ba114 from __future__ import with_statement addon for 'with', mostly written by
Neal.
2006-02-28 19:02:24 +00:00
Jeremy Hylton a829313d7b Remove asdl_seq_APPEND() and simplify asdl seq implementation.
Clarify intended use of set_context() and check errors at all call sites.
2006-02-28 17:58:27 +00:00
Jeremy Hylton 77f1bb2778 Real arena implementation
Replace the toy arena implementation with a real one,
based on allocating 8K chunks of memory by default.
2006-02-28 17:53:04 +00:00
Thomas Wouters f7f438ba3b SF patch #1438387, PEP 328: relative and absolute imports.
- IMPORT_NAME takes an extra argument from the stack: the relativeness of
   the import. Only passed to __import__ when it's not -1.

 - __import__() takes an optional 5th argument for the same thing; it
   __defaults to -1 (old semantics: try relative, then absolute)

 - 'from . import name' imports name (be it module or regular attribute)
   from the current module's *package*. Likewise, 'from .module import name'
   will import name from a sibling to the current module.

 - Importing from outside a package is not allowed; 'from . import sys' in a
   toplevel module will not work, nor will 'from .. import sys' in a
   (single-level) package.

 - 'from __future__ import absolute_import' will turn on the new semantics
   for import and from-import: imports will be absolute, except for
   from-import with dots.

Includes tests for regular imports and importhooks, parser changes and a
NEWS item, but no compiler-package changes or documentation changes.
2006-02-28 16:09:29 +00:00
Guido van Rossum c2e20744b2 PEP 343 -- the with-statement.
This was started by Mike Bland and completed by Guido
(with help from Neal).

This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.

There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
2006-02-27 22:32:47 +00:00
Martin v. Löwis 15e62742fa Revert backwards-incompatible const changes. 2006-02-27 16:46:16 +00:00
Thomas Wouters dca3b9c797 PEP 308 implementation, including minor refdocs and some testcases. It
breaks the parser module, because it adds the if/else construct as well as
two new grammar rules for backward compatibility. If no one else fixes
parsermodule, I guess I'll go ahead and fix it later this week.

The TeX code was checked with texcheck.py, but not rendered. There is
actually a slight incompatibility:

>>> (x for x in lambda:0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: iteration over non-sequence

changes into

>>> (x for x in lambda: 0)
  File "<stdin>", line 1
    (x for x in lambda: 0)
                     ^
SyntaxError: invalid syntax

Since there's no way the former version can be useful, it's probably a
bugfix ;)
2006-02-27 00:24:13 +00:00
Martin v. Löwis bd260da900 Generate code to recursively copy an AST into
a tree of Python objects. Expose this through compile().
2006-02-26 19:42:26 +00:00
Neal Norwitz ab51f5f24d Per discussion on python-dev, remove CO_GENERATOR_ALLOWED. Leave comment about not removing yet. 2006-02-25 15:43:10 +00:00
Georg Brandl c255c7bef7 Bug #1086854: Rename PyHeapType members adding ht_ prefix. 2006-02-20 22:27:28 +00:00
Neal Norwitz 0090a4c10d Generators have been permanent for a while. This comment is no longer applicable. 2006-02-19 18:49:30 +00:00
Martin v. Löwis 2d65b5542b Fix intptr_t fallback for Py_ssize_t. 2006-02-18 18:26:55 +00:00
Martin v. Löwis 41290685f9 Change _PyObject_GC_Resize to expect Py_ssize_t. 2006-02-16 14:56:14 +00:00
Martin v. Löwis 97c65a8068 Use Py_ssize_t for field sizes and offsets. 2006-02-16 14:24:38 +00:00
Martin v. Löwis 44e379d573 Allow for ssize_t field offsets. 2006-02-16 14:23:19 +00:00
Martin v. Löwis 18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Armin Rigo f5b3e36493 Renamed _length_cue() to __length_hint__(). See:
http://mail.python.org/pipermail/python-dev/2006-February/060524.html
2006-02-11 21:32:43 +00:00
Barry Warsaw b941825fa2 Fix PyGC_Collect() to be exported from the built DLL on Windows. (Fix given
by Matt Messier).
2006-01-26 18:59:06 +00:00
Neal Norwitz 8208b64670 Fix icc warnings: single bit fields should be unsigned 2006-01-07 21:25:23 +00:00
Martin v. Löwis 43b57805fb Drop sys.build_number. Add sys.subversion. 2006-01-05 23:38:54 +00:00
Tim Peters c3d12ac88c const poisoning, spreading to fix new const warnings
in _winreg.c.
2005-12-24 06:03:06 +00:00