<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Lib/doctest.py, branch 2.2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Lib/doctest.py?h=2.2</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Lib/doctest.py?h=2.2'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2001-10-23T02:21:52Z</updated>
<entry>
<title>SF bug [#473864] doctest expects spurios space.</title>
<updated>2001-10-23T02:21:52Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-10-23T02:21:52Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=c77db34575f8ea73a5f53baf5a68fb0d39850573'/>
<id>urn:sha1:c77db34575f8ea73a5f53baf5a68fb0d39850573</id>
<content type='text'>
Repair unlikely surprise due to magical softspace attr and the use of
print with a trailing comma in doctest examples.
Bugfix candidate.
</content>
</entry>
<entry>
<title>SF bug [#467336] doctest failures w/ new-style classes.</title>
<updated>2001-10-03T04:08:26Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-10-03T04:08:26Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=17111f3b242be06c7ae913f106093891b82d7fee'/>
<id>urn:sha1:17111f3b242be06c7ae913f106093891b82d7fee</id>
<content type='text'>
Taught doctest about static methods, class methods, and property docstrings
in new-style classes.  As for inspect.py/pydoc.py before it, the new stuff
needed didn't really fit into the old architecture (but was less of a
strain to force-fit here).
New-style class docstrings still aren't found, but that's the subject
of a different bug and I want to fix that right instead of hacking around
it in doctest.
</content>
</entry>
<entry>
<title>SF patch [#466616] Exclude imported items from doctest.</title>
<updated>2001-10-02T22:47:08Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-10-02T22:47:08Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=4a9ac4a83c5515df1b62e396a753ac17a931f997'/>
<id>urn:sha1:4a9ac4a83c5515df1b62e396a753ac17a931f997</id>
<content type='text'>
Another installment; the new functionality wasn't actually enabled in
normal use, only in the strained use checked by the test case.
</content>
</entry>
<entry>
<title>SF patch [#466616] Exclude imported items from doctest,</title>
<updated>2001-10-02T03:53:41Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-10-02T03:53:41Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=7402f791a4633689fea904b2bd9caea2b25de620'/>
<id>urn:sha1:7402f791a4633689fea904b2bd9caea2b25de620</id>
<content type='text'>
from Tim Hochberg.  Also mucho fiddling to change the way doctest
determines whether a thing is a function, module or class.  Under 2.2,
this really requires the functions in inspect.py (e.g., types.ClassType
is close to meaningless now, if not outright misleading).
</content>
</entry>
<entry>
<title>Remove the horrid generators hack from doctest.py.  This relies on a</title>
<updated>2001-08-18T00:05:50Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-08-18T00:05:50Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=4fd9e2fc134a8a95fa9ef29e39572f82f3b5240e'/>
<id>urn:sha1:4fd9e2fc134a8a95fa9ef29e39572f82f3b5240e</id>
<content type='text'>
somewhat less horrid hack &lt;wink&gt;:  if a module does
    from __future__ import X
then the module dict D is left in a state such that (viewing X as a
string)
    D[X] is getattr(__future__, X)
So by examining D for all the names of future features, and making that
test for each, we can make a darned good guess as to which future-features
were imported by the module.  The appropriate flags are then sucked out
of the __future__ module, and passed on to compile()'s new optional
arguments (PEP 264).

Also gave doctest a meaningful __all__, removed the history of changes
(CVS serves that purpose now), and removed the __version__ vrbl (similarly;
before CVS, it was a reasonable clue, but not anymore).
</content>
</entry>
<entry>
<title>Document doctest's generator-future hack.</title>
<updated>2001-07-16T18:39:58Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-07-16T18:39:58Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=03813399cc19b09cddd031b3c2924038423098f0'/>
<id>urn:sha1:03813399cc19b09cddd031b3c2924038423098f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Ugly.  A pile of new xxxFlags() functions, to communicate to the parser</title>
<updated>2001-07-16T05:37:24Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-07-16T05:37:24Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=fe2127d3cbf34452a10b88c40e5ab06870936f94'/>
<id>urn:sha1:fe2127d3cbf34452a10b88c40e5ab06870936f94</id>
<content type='text'>
that 'yield' is a keyword.  This doesn't help test_generators at all!  I
don't know why not.  These things do work now (and didn't before this
patch):

1. "from __future__ import generators" now works in a native shell.

2. Similarly "python -i xxx.py" now has generators enabled in the
   shell if xxx.py had them enabled.

3. This program (which was my doctest proxy) works fine:

from __future__ import generators

source = """\
def f():
    yield 1
"""

exec compile(source, "", "single") in globals()
print type(f())
</content>
</entry>
<entry>
<title>Changed some comments.  Removed the caution about clearing globs, since</title>
<updated>2001-06-24T20:24:16Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-06-24T20:24:16Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=fee69d0313afcbe38b4ac3803c70b7420f575f94'/>
<id>urn:sha1:fee69d0313afcbe38b4ac3803c70b7420f575f94</id>
<content type='text'>
clearing a shallow copy _run_examples() makes itself can't hurt anything.
</content>
</entry>
<entry>
<title>Clear the copy of the globs dict after running examples.  This helps to</title>
<updated>2001-06-24T20:02:47Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-06-24T20:02:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=d4ad59e1eb9623acb8af5555a58984fe6a252183'/>
<id>urn:sha1:d4ad59e1eb9623acb8af5555a58984fe6a252183</id>
<content type='text'>
break cycles, which are a special problem when running generator tests
that provoke exceptions by invoking the .next() method of a named
generator-iterator:  then the iterator is named in globs, and the
iterator's frame gets a tracekback object pointing back to globs, and
gc doesn't chase these types so the cycle leaks.

Also changed _run_examples() to make a copy of globs itself, so its
callers (direct and indirect) don't have to (and changed the callers
to stop making their own copies); *that* much is a change I've been
meaning to make for a long time (it's more robust the new way).

Here's a way to provoke the symptom without doctest; it leaks at a
prodigious rate; if the last two "source" lines are replaced with
    g().next()
the iterator isn't named and then there's no leak:

source = """\
def g():
    yield 1/0

k = g()
k.next()
"""

code = compile(source, "&lt;source&gt;", "exec")

def f(globs):
    try:
        exec code in globs
    except ZeroDivisionError:
        pass

while 1:
    f(globals().copy())

After this change, running test_generators in an infinite loop still leaks,
but reduced from a flood to a trickle.
</content>
</entry>
<entry>
<title>doctest systematically leaked memory when handling an exception in an</title>
<updated>2001-06-24T18:59:01Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-06-24T18:59:01Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=77f2d504c3891ff7f75d1e50d12b4cdb30e89767'/>
<id>urn:sha1:77f2d504c3891ff7f75d1e50d12b4cdb30e89767</id>
<content type='text'>
example (an obvious trackback cycle).  Repaired.
Bugfix candidate.
</content>
</entry>
</feed>
