Commit Graph

28 Commits

Author SHA1 Message Date
Georg Brandl 8943caf716 Merged revisions 70642,70648,70656,70661,70765,70773,70789,70824-70825,70828,70830,70832,70836,70838,70842,70851,70855,70857-70858 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70642 | georg.brandl | 2009-03-28 01:48:48 +0100 (Sa, 28 Mär 2009) | 1 line

  Fix typo.
........
  r70648 | georg.brandl | 2009-03-28 20:10:37 +0100 (Sa, 28 Mär 2009) | 1 line

  #5324: document __subclasses__().
........
  r70656 | georg.brandl | 2009-03-28 20:33:33 +0100 (Sa, 28 Mär 2009) | 2 lines

  Add a script to fixup rst files if the pre-commit hook rejects them.
........
  r70661 | georg.brandl | 2009-03-28 20:57:36 +0100 (Sa, 28 Mär 2009) | 2 lines

  Add section numbering to some of the larger subdocuments.
........
  r70765 | georg.brandl | 2009-03-31 00:09:34 +0200 (Di, 31 Mär 2009) | 1 line

  #5199: make warning about vars() assignment more visible.
........
  r70773 | georg.brandl | 2009-03-31 00:43:00 +0200 (Di, 31 Mär 2009) | 1 line

  #5039: make it clear that the impl. note refers to CPython.
........
  r70789 | georg.brandl | 2009-03-31 03:25:15 +0200 (Di, 31 Mär 2009) | 1 line

  Fix a wrong struct field assignment (docstring as closure).
........
  r70824 | georg.brandl | 2009-03-31 17:43:20 +0200 (Di, 31 Mär 2009) | 1 line

  #5519: remove reference to Kodos, which seems dead.
........
  r70825 | georg.brandl | 2009-03-31 17:46:30 +0200 (Di, 31 Mär 2009) | 1 line

  #5566: fix versionadded from PyLong ssize_t functions.
........
  r70828 | georg.brandl | 2009-03-31 17:50:16 +0200 (Di, 31 Mär 2009) | 1 line

  #5581: fget argument of abstractproperty is optional as well.
........
  r70830 | georg.brandl | 2009-03-31 18:11:45 +0200 (Di, 31 Mär 2009) | 1 line

  #5529: backport new docs of import semantics written by Brett to 2.x.
........
  r70832 | georg.brandl | 2009-03-31 18:31:11 +0200 (Di, 31 Mär 2009) | 1 line

  #1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
  r70836 | georg.brandl | 2009-03-31 18:50:25 +0200 (Di, 31 Mär 2009) | 1 line

  #5417: replace references to undocumented functions by ones to documented functions.
........
  r70838 | georg.brandl | 2009-03-31 18:54:38 +0200 (Di, 31 Mär 2009) | 1 line

  #992207: document that the parser only accepts \\n newlines.
........
  r70842 | georg.brandl | 2009-03-31 19:13:06 +0200 (Di, 31 Mär 2009) | 1 line

  #970783: document PyObject_Generic[GS]etAttr.
........
  r70851 | georg.brandl | 2009-03-31 20:26:55 +0200 (Di, 31 Mär 2009) | 1 line

  #837577: note cryptic return value of spawn*e on invalid env dicts.
........
  r70855 | georg.brandl | 2009-03-31 20:30:37 +0200 (Di, 31 Mär 2009) | 1 line

  #5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
  r70857 | georg.brandl | 2009-03-31 20:33:10 +0200 (Di, 31 Mär 2009) | 1 line

  #5227: note that Py_Main doesnt return on SystemExit.
........
  r70858 | georg.brandl | 2009-03-31 20:38:56 +0200 (Di, 31 Mär 2009) | 1 line

  #5241: document missing U in regex howto.
........
2009-04-05 21:11:43 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Georg Brandl 5ffad6646e Make generator repr consistent with function and code object repr. 2008-05-16 09:34:48 +00:00
Georg Brandl c91210c06b #2863: add gen.__name__ and add this name to generator repr(). 2008-05-15 15:08:32 +00:00
Georg Brandl 0cdf9a36ec #1473257: add generator.gi_code attribute that refers to
the original code object backing the generator. Patch by Collin Winter.
2008-01-26 14:14:20 +00:00
Christian Heimes e93237dfcc #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available. 2007-12-19 02:37:44 +00:00
Brett Cannon 4c20bc40d7 Generators had their throw() method allowing string exceptions. That's a
no-no.

Fixes issue #1147.  Need to fix 2.5 to raise a proper warning if a string
exception is passed in.
2007-09-11 21:02:28 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Georg Brandl 96a8c3954c Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +00:00
Tim Peters 81b092d0e6 gen_del(): Looks like much this was copy/pasted from
slot_tp_del(), but while the latter had to cater to types
that don't participate in GC, we know that generators do.
That allows strengthing an assert().
2006-04-15 22:59:10 +00:00
Thomas Wouters 447d095976 - Whitespace normalization
- In functions where we already hold the same object in differently typed
   pointers, use the correctly typed pointer instead of casting the other
   pointer a second time.
2006-04-15 21:41:56 +00:00
Phillip J. Eby 8ebb28df3a Fix SF#1470508: crash in generator cycle finalization. There were two
problems: first, PyGen_NeedsFinalizing() had an off-by-one bug that
prevented it from ever saying a generator didn't need finalizing, and
second, frame objects cleared themselves in a way that caused their
owning generator to think they were still executable, causing a double
deallocation of objects on the value stack if there was still a loop
on the block stack.  This revision also removes some unnecessary
close() operations from test_generators that are now appropriately
handled by the cycle collector.
2006-04-15 01:02:17 +00:00
Anthony Baxter 3109d62da6 Add a cast to make code compile with a C++ compiler. 2006-04-13 01:07:27 +00:00
Phillip J. Eby 8920bf24f8 Don't set gi_frame to Py_None, use NULL instead, eliminating some insane
pointer dereferences.
2006-04-12 19:07:15 +00:00
Neal Norwitz 017749c33d wrap docstrings so they are less than 80 columns. add spaces after commas. 2006-04-12 06:56:56 +00:00
Tim Peters a5a80cb4a4 gen_throw(): The caller doesn't own PyArg_ParseTuple()
"O" arguments, so must not decref them.  This accounts
for why running test_contextlib.test_main() in a loop
eventually tried to deallocate Py_None.
2006-04-12 06:44:36 +00:00
Phillip J. Eby 2ba96610bf SF Patch #1463867: Improved generator finalization to allow generators
that are suspended outside of any try/except/finally blocks to be
garbage collected even if they are part of a cycle.  Generators that
suspend inside of an active try/except or try/finally block (including
those created by a ``with`` statement) are still not GC-able if they
are part of a cycle, however.
2006-04-10 17:51:05 +00:00
Phillip J. Eby bee0712214 Support throw() of string exceptions. 2006-03-25 00:05:50 +00:00
Martin v. Löwis 725507b52e Change int to Py_ssize_t in several places.
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
2006-03-07 12:08:51 +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
Armin Rigo 967aa8b349 * Refcount leak. It was just a reference to Py_None, but still.
* Allow the 3rd argument to generator.throw() to be None.
  The 'raise' statement does the same, and anyway it follows the
  general policy that optional arguments of built-ins should, when
  reasonable, have a default value specifiable from Python.
2006-02-14 15:50:44 +00:00
Phillip J. Eby 00148226df Fix a too-aggressive assert (see SF#1257960). Previously, gen_iternext
was never called during interpreter shutdown GC, so the f_back!=NULL
assertion was correct.  Now that generators get close()d during GC,
the assertion was being triggered because the generator close() was being
called as the top-level frame.  However, nothing actually is broken by
this; it's just that the condition was unexpected in previous Python
versions.
2005-08-13 03:29:00 +00:00
Phillip J. Eby 0d6615fd29 PEP 342 implementation. Per Guido's comments, the generator throw()
method still needs to support string exceptions, and allow None for the
third argument.  Documentation updates are needed, too.
2005-08-02 00:46:46 +00:00
Raymond Hettinger 75ccea3777 SF patch #1020188: Use Py_CLEAR where necessary to avoid crashes
(Contributed by Dima Dorfman)
2004-09-01 07:02:44 +00:00
Martin v. Löwis 8d97e33bb7 Patch #966493: Cleanup generator/eval_frame exposure. 2004-06-27 15:43:12 +00:00
Raymond Hettinger 6c7a00fbaa * Factor out PyObject_SelfIter().
* Change a XDECREF to DECREF (adding an assertion just to be sure).
2004-06-12 05:17:55 +00:00
Martin v. Löwis e440e47e91 Patch #957398: Add public API for Generator Object/Type. 2004-06-01 15:22:42 +00:00