Commit Graph

38460 Commits

Author SHA1 Message Date
Eric Smith a73fbe791d Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct(). 2008-02-23 03:09:44 +00:00
Raymond Hettinger 73d7963242 Improve the implementation of itertools.product()
* Fix-up issues pointed-out by Neal Norwitz.
* Add extensive comments.
* The lz->result variable is now a tuple instead of a list.
* Use fast macro getitem/setitem calls so most code is in-line.
* Re-use the result tuple if available (modify in-place instead of copy).
2008-02-23 02:20:41 +00:00
Raymond Hettinger c5705a823b Document itertools.product(). 2008-02-22 19:50:06 +00:00
Eric Smith fb0742fe4f Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin. 2008-02-22 17:43:17 +00:00
Eric Smith 3cd8194b9c Added bin() builtin. I'm going to check in the tests in a seperate checkin, because the builtin doesn't need to be ported to py3k, but the tests are missing in py3k and need to be merged there. 2008-02-22 16:30:22 +00:00
Georg Brandl 1699db145f Another fix. 2008-02-22 12:57:05 +00:00
Georg Brandl 4e37c66262 Don't reference pyshell. 2008-02-22 12:56:34 +00:00
Georg Brandl 907a720f89 A lot more typo fixes by Ori Avtalion. 2008-02-22 12:31:45 +00:00
Nick Coghlan a14a4e8b84 Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery) 2008-02-22 10:54:06 +00:00
Raymond Hettinger 50986cc45b First draft for itertools.product(). Docs and other updates forthcoming. 2008-02-22 03:16:42 +00:00
Georg Brandl 12db865a64 Part of #2154: minimal syntax fixes in doc example snippets. 2008-02-21 20:38:13 +00:00
Georg Brandl 359b9e994b #2079: typo in userdict docs. 2008-02-21 20:33:38 +00:00
Eric Smith ce584d420d Moved test_format into the correct TestCase. 2008-02-21 20:17:08 +00:00
Guido van Rossum af16ece18e Fix a few typos and layout glitches (more work is needed).
Move 2.5 news to Misc/HISTORY.
2008-02-21 19:46:35 +00:00
Raymond Hettinger 31ce5cb989 Update more instances of has_key(). 2008-02-21 19:24:53 +00:00
Thomas Heller 8982cf5484 Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
2008-02-21 18:52:20 +00:00
Thomas Heller 981f31860b configure.ac: Remove the configure check for _Bool, it is already done in the
top-level Python configure script.
configure, fficonfig.h.in: regenerated.
2008-02-21 18:28:48 +00:00
Guido van Rossum 8bc0965adf Removed uses of dict.has_key() from distutils, and uses of
callable() from copy_reg.py, so the interpreter now starts up
without warnings when '-3' is given.  More work like this needs to
be done in the rest of the stdlib.
2008-02-21 18:18:37 +00:00
Guido van Rossum b5e2684a1a Remove news about float repr() -- issue 1580 is still in limbo. 2008-02-21 17:46:16 +00:00
Andrew M. Kuchling 2d6c13e733 Close manifest file.
This change doesn't make any difference to CPython, but is a necessary fix for Jython.
2008-02-21 14:23:38 +00:00
Eric Smith 8a803dd94b Now that PyOS_ascii_formatd supports the 'n' format, simplify the float formatting code to just call it. 2008-02-20 23:39:28 +00:00
Eric Smith 7ef40bf9c7 Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description). 2008-02-20 23:34:22 +00:00
Georg Brandl e1b8e9c666 Fixes contributed by Ori Avtalion. 2008-02-20 19:12:36 +00:00
Eric Smith 5a3c135e17 Added PEP 3101. 2008-02-19 13:21:56 +00:00
Eric Smith ba486c5362 Added dependencies for stringobject.o. This should fix failing tests in test_unicode.py. 2008-02-19 12:27:59 +00:00
Eric Smith bc32fee029 Added code to correct combining str and unicode in ''.format(). Added test case. 2008-02-18 18:02:34 +00:00
Kristján Valur Jónsson 5299935be5 Perform correct handling of stack overflow for windows: Catch the correct exception code and reset the overflow condition when handled. 2008-02-18 17:40:47 +00:00
Eric Smith d50a5f2845 Temporarily removed float tests. See issue 1600. 2008-02-18 14:25:02 +00:00
Facundo Batista d14600ec94 Issue 1224. Now we support again the double slash in the URL.
Thanks Anthony Lenton.
2008-02-18 12:48:43 +00:00
Facundo Batista 759bfc6207 Issue #1916. Added isgenerator() and isgeneratorfunction() to
inspect.py.  Thanks Javi Mansilla for patch review and
corrections.
2008-02-18 03:43:43 +00:00
Georg Brandl b169eaa917 #2133: fix HTML color spec. 2008-02-17 21:18:55 +00:00
Amaury Forgeot d'Arc e7fa408741 Compilation was broken on Windows since the introduction of Advanced String Formatting.
Only PCBuild (vs9) was really tested.
Changes for older compilers were done manually.
2008-02-17 20:56:31 +00:00
Eric Smith a9f7d62480 Backport of PEP 3101, Advanced String Formatting, from py3k.
Highlights:
 - Adding PyObject_Format.
 - Adding string.Format class.
 - Adding __format__ for str, unicode, int, long, float, datetime.
 - Adding builtin format.
 - Adding ''.format and u''.format.
 - str/unicode fixups for formatters.

The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k.  Any changes from here on should be made to trunk, and
changes will propogate to py3k).
2008-02-17 19:46:49 +00:00
Facundo Batista e139688d34 Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
2008-02-17 18:59:29 +00:00
Facundo Batista f88a077f69 Now we handle different the backup copy, because of security
issues regarding user/group and permissions. Fixes 1050828.
2008-02-17 16:21:13 +00:00
Georg Brandl 27cca3cca7 Fix function name. 2008-02-17 15:14:10 +00:00
Georg Brandl 5e203f56db #2131: note that codecs.open() always opens files in binary mode. 2008-02-17 11:33:38 +00:00
Brett Cannon f9db8a3a20 Move test_logging over to doctest.
Thanks to Christopher White from GHOP.
2008-02-17 01:59:18 +00:00
Amaury Forgeot d'Arc 632fad3933 Prevent a crash with nested scopes, again caused by calling Py_DECREF when the pointer
is still present in the containing structure.
2008-02-16 20:55:24 +00:00
Amaury Forgeot d'Arc 588ff93f13 Crashers of the day: Py_CLEAR must be used when there is a chance that the
function can be called recursively.
This was discussed in issue1020188.

In python codebase, all occurrences of Py_[X]DECREF(xxx->yyy) are suspect,
except when they appear in tp_new or tp_dealloc functions, or when
the member cannot be of a user-defined class.
Note that tp_init is not safe.

I do have a (crashing) example for every changed line.
Is it worth adding them to the test suite?

Example:

class SpecialStr(str):
    def __del__(self):
        s.close()

import cStringIO
s = cStringIO.StringIO(SpecialStr("text"))
s.close() # Segfault
2008-02-16 14:34:57 +00:00
Georg Brandl 943321d586 #2120: broken links in advocacy document. 2008-02-16 09:37:32 +00:00
Raymond Hettinger 71fa93af22 Add __all__ to logging module. 2008-02-16 01:22:54 +00:00
Amaury Forgeot d'Arc 64d6843788 mmap.PROT_READ does not exists on win32;
Skip this test created by r60830.
2008-02-16 00:16:50 +00:00
Amaury Forgeot d'Arc d8bcbf2b2e Re-enable tests, they were failing since gc.collect() clears the various freelists.
They still remain fragile.

For example, a call to assertEqual currently does not make any allocation
(which surprised me at first).
But this can change when gc.collect also deletes the numerous "zombie frames"
attached to each function.
2008-02-15 22:44:20 +00:00
Kurt B. Kaiser f05fa33a6c Configured selection highlighting colors were ignored; updating highlighting
in the config dialog would cause non-Python files to be colored as if they
were Python source; improve use of ColorDelagator.  Patch 1334. Tal Einat.
2008-02-15 22:25:09 +00:00
Kurt B. Kaiser e312cfddd3 ScriptBinding event handlers weren't returning 'break'. Patch 2050, Tal Einat. 2008-02-15 21:56:36 +00:00
Amaury Forgeot d'Arc f67abccf64 Temporarily let these tests pass 2008-02-15 21:27:44 +00:00
Amaury Forgeot d'Arc 60d6c7f0cc Issue #2115: __slot__ attributes setting was 10x slower.
Also correct a possible crash using ABCs.

This change is exactly the same as an optimisation
done 5 years ago, but on slot *access*:
http://svn.python.org/view?view=rev&rev=28297
2008-02-15 21:22:45 +00:00
Raymond Hettinger e9b9b35931 Update example to match the current syntax. 2008-02-15 21:21:25 +00:00
Skip Montanaro 04735179f0 Two new functions:
* place_summary_first copies the regrtest summary to the front of the file
    making it easier to scan quickly for problems.

  * count_failures gets the actual count of the number of failing tests, not
    just a 1 (some failures) or 0 (no failures).
2008-02-15 19:03:59 +00:00