summaryrefslogtreecommitdiff
path: root/Objects/genobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Make use of METH_O and METH_NOARGS where possible.Georg Brandl2006-05-291-1/+1
| | | | Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
* gen_del(): Looks like much this was copy/pasted fromTim Peters2006-04-151-1/+1
| | | | | | 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().
* - Whitespace normalizationThomas Wouters2006-04-151-12/+14
| | | | | | - 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.
* Fix SF#1470508: crash in generator cycle finalization. There were twoPhillip J. Eby2006-04-151-10/+11
| | | | | | | | | | | 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.
* Add a cast to make code compile with a C++ compiler.Anthony Baxter2006-04-131-1/+1
|
* Don't set gi_frame to Py_None, use NULL instead, eliminating some insanePhillip J. Eby2006-04-121-7/+7
| | | | pointer dereferences.
* wrap docstrings so they are less than 80 columns. add spaces after commas.Neal Norwitz2006-04-121-3/+5
|
* gen_throw(): The caller doesn't own PyArg_ParseTuple()Tim Peters2006-04-121-3/+1
| | | | | | "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.
* SF Patch #1463867: Improved generator finalization to allow generatorsPhillip J. Eby2006-04-101-0/+20
| | | | | | | | 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.
* Support throw() of string exceptions.Phillip J. Eby2006-03-251-1/+4
|
* Change int to Py_ssize_t in several places.Martin v. Löwis2006-03-071-1/+1
| | | | | Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
* PEP 352 implementation. Creates a new base class, BaseException, which has anBrett Cannon2006-03-011-3/+3
| | | | | | | | | 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.
* * Refcount leak. It was just a reference to Py_None, but still.Armin Rigo2006-02-141-3/+9
| | | | | | | * 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.
* Fix a too-aggressive assert (see SF#1257960). Previously, gen_iternextPhillip J. Eby2005-08-131-1/+1
| | | | | | | | | 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.
* PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby2005-08-021-5/+234
| | | | | method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
* SF patch #1020188: Use Py_CLEAR where necessary to avoid crashesRaymond Hettinger2004-09-011-2/+1
| | | | (Contributed by Dima Dorfman)
* Patch #966493: Cleanup generator/eval_frame exposure.Martin v. Löwis2004-06-271-1/+1
|
* * Factor out PyObject_SelfIter().Raymond Hettinger2004-06-121-9/+3
| | | | * Change a XDECREF to DECREF (adding an assertion just to be sure).
* Patch #957398: Add public API for Generator Object/Type.Martin v. Löwis2004-06-011-0/+129