Commit Graph

12555 Commits

Author SHA1 Message Date
Georg Brandl e260ba2d33 #1325: Add docs and tests for zipimporter.archive and zipimporter.prefix. 2008-01-06 16:49:50 +00:00
Georg Brandl c45346f57a #1591: Clarify docstring of Popen3. 2008-01-06 14:33:52 +00:00
Georg Brandl 183a084da3 #1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
2008-01-06 14:27:15 +00:00
Georg Brandl e2a902c669 #1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
2008-01-06 14:17:36 +00:00
Raymond Hettinger 1166872006 Small code simplification. Forgot that classmethods can be called from intances. 2008-01-06 09:02:24 +00:00
Guido van Rossum c6a04c2629 Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
2008-01-05 22:19:06 +00:00
Georg Brandl f725b9587c Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst. 2008-01-05 19:44:22 +00:00
Andrew M. Kuchling 0589914e60 Fix comment typo 2008-01-05 15:13:49 +00:00
Jeffrey Yasskin 9871d8fe22 Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
 * Revert round to its 2.6 behavior (half away from 0).
 * Because round, floor, and ceil always return float again, it's no
   longer necessary to have them delegate to __xxx___, so I've ripped
   that out of their implementations and the Real ABC. This also helps
   in implementing types that work in both 2.6 and 3.0: you return int
   from the __xxx__ methods, and let it get enabled by the version
   upgrade.
 * Make pow(-1, .5) raise a ValueError again.
2008-01-05 08:47:13 +00:00
Fred Drake f7476c4d46 clean up a comment 2008-01-05 04:38:38 +00:00
Raymond Hettinger 1b50fd7cb3 Add error-checking to namedtuple's _replace() method. 2008-01-05 02:17:24 +00:00
Raymond Hettinger 02740f73ff Improve namedtuple's _cast() method with a docstring, new name, and error-checking. 2008-01-05 01:35:43 +00:00
Guido van Rossum ced4eb06e4 Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py. 2008-01-05 01:21:57 +00:00
Guido van Rossum 3b83549ea0 Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
2008-01-05 00:59:59 +00:00
Christian Heimes a47b75b0a0 socket.ioctl is only available on Windows 2008-01-04 15:48:06 +00:00
Christian Heimes 04ae916fa2 Added interface to Windows' WSAIoctl and a simple example for a network sniffer. 2008-01-04 15:23:30 +00:00
Lars Gustäbel 2ee1c760cc Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.

(will backport to 2.5)
2008-01-04 14:00:33 +00:00
Christian Heimes 0687561c94 Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint. 2008-01-04 13:21:07 +00:00
Jeffrey Yasskin 737c73f96f Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
2008-01-04 08:01:23 +00:00
Raymond Hettinger e0734e7dc0 Minor fix-ups to named tuples:
* Make the _replace() method respect subclassing.

* Using property() to make _fields read-only wasn't a good idea.
  It caused len(Point._fields) to fail.

* Add note to _cast() about length checking and alternative with the star-operator.
2008-01-04 03:22:53 +00:00
Christian Heimes 76d19f68e4 Added _struct._clearcache() for regression tests 2008-01-04 02:54:42 +00:00
Christian Heimes f2f41ebef4 Fixed refleak tests for _struct changes 2008-01-04 02:46:19 +00:00
Christian Heimes 8267d1dfe5 Bug #1481296: Fixed long(float('nan'))!=0L. 2008-01-04 00:37:34 +00:00
Christian Heimes 0613188bc3 Fixed #1687: plistlib.py restricts <integer> to Python int when writing 2008-01-04 00:04:52 +00:00
Raymond Hettinger 2f6621cce7 Finish-up the struct module optimizations started at the Iceland NFS sprint. 2008-01-04 00:01:15 +00:00
Christian Heimes eebb79cc69 Added copysign(x, y) function to the math module 2008-01-03 22:32:26 +00:00
Christian Heimes e2ca4245c9 Added math.isinf() and math.isnan() 2008-01-03 20:23:15 +00:00
Guido van Rossum ae04c3356e Issue #1700, reported by Nguyen Quan Son, fix by Fredruk Lundh:
Regular Expression inline flags not handled correctly for some unicode
characters.  (Forward port from 2.5.2.)
2008-01-03 19:12:44 +00:00
Jeffrey Yasskin 2f3c16be73 Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689.
2008-01-03 02:21:52 +00:00
Guido van Rossum 27edd829d7 Patch #1696. Don't attempt to close None in dry-run mode. 2008-01-02 19:00:46 +00:00
Kurt B. Kaiser 0a11232978 Change docstrings to comments so test output will display normally. 2008-01-02 05:23:38 +00:00
Kurt B. Kaiser 0f7c25d20f Issue1177
r58207 and r58247 patch logic is reversed.  I noticed this when I
tried to use urllib to retrieve a file which required auth.

Fix that and add a test for 401 error to verify.
2008-01-02 04:11:28 +00:00
Martin v. Löwis f5d902fc47 Always convert Text.index result to string.
This improves compatibility with Tcl 8.5, which would
otherwise return textindex objects.
2008-01-01 21:08:18 +00:00
Christian Heimes 9a1d8cec11 Added support for new Windows build dirs in PC/ to distutils.sysconfig 2008-01-01 14:37:32 +00:00
Guido van Rossum 96b3249670 Fix an odd error which would only occur close to new year's eve, due
to use of datetime.datetime.now() instead of utcnow() for comparison.
(I think the test can still fail if it's executed pretty much *at*
new year's eve, but that's not worth fixing.)
2008-01-01 04:15:29 +00:00
Christian Heimes cdaa2cbfd5 Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
2007-12-31 14:47:07 +00:00
Kurt B. Kaiser 28c7bcf38e Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat. 2007-12-28 04:18:01 +00:00
Brett Cannon a6e515b90d Remove a straggling debugging print line. 2007-12-25 06:44:59 +00:00
Brett Cannon 4e438bcc56 Actually execute the tests for the getter/setter/deleter tests on properties.
Also fix the test by having the test classes inherit from object.

Are the getter/setter/deleter attributes supposed to be able to chain?  As of
right now they can't as the property tries to call what the property returns,
which is another property when they are chained.
2007-12-25 00:14:34 +00:00
Guido van Rossum e9a0e885db Patch #1672 by Joseph Armbruster. Use tempdir() to get a temporary directory. 2007-12-20 17:28:10 +00:00
Brett Cannon 905c31c73d Add tests for the warnings module; specifically formatwarning and showwarning.
Still need tests for warn_explicit and simplefilter.
2007-12-20 10:09:52 +00:00
Guido van Rossum 0b7b6fdff3 Patch #1549 by Thomas Herve.
This changes the rules for when __hash__ is inherited slightly,
by allowing it to be inherited when one or more of __lt__, __le__,
__gt__, __ge__ are overridden, as long as __eq__ and __ne__ aren't.
2007-12-19 22:51:13 +00:00
Guido van Rossum 02de8979cc Patch #1583 by Adam Olsen.
This adds signal.set_wakeup_fd(fd) which sets a file descriptor to
which a zero byte will be written whenever a C exception handler runs.

I added a simple C API as well, PySignal_SetWakeupFd(fd).
2007-12-19 19:41:06 +00:00
Raymond Hettinger 80016c9555 Fix issue 1661: Flags argument silently ignored in re functions with compiled regexes. 2007-12-19 18:13:31 +00:00
Facundo Batista 0f5e7bf304 Some minor cleanups. Thanks Mark Dickinson. 2007-12-19 12:53:01 +00:00
Raymond Hettinger 3b63556d4a Beef-up tests for dict literals 2007-12-19 00:21:06 +00:00
Raymond Hettinger 85dfcf3530 Users demand iterable input for named tuples. The author capitulates. 2007-12-18 23:51:15 +00:00
Christian Heimes 0a8143f646 Applied patch #1635: Float patch for inf and nan on Windows (and other platforms).
The patch unifies float("inf") and repr(float("inf")) on all platforms.
2007-12-18 23:22:54 +00:00
Raymond Hettinger 8777bcae27 Simplify and speedup _asdict() for named tuples. 2007-12-18 22:21:27 +00:00
Christian Heimes 0423698bc3 Fixed #1649: IDLE error: dictionary changed size during iteration 2007-12-18 21:56:09 +00:00
Raymond Hettinger fd7ed407d7 Give meaning to the oparg for BUILD_MAP: estimated size of the dictionary.
Allows dictionaries to be pre-sized (upto 255 elements) saving time lost
to re-sizes with their attendant mallocs and re-insertions.

Has zero effect on small dictionaries (5 elements or fewer), a slight
benefit for dicts upto 22 elements (because they had to resize once
anyway), and more benefit for dicts upto 255 elements (saving multiple
resizes during the build-up and reducing the number of collisions on
the first insertions).  Beyond 255 elements, there is no addional benefit.
2007-12-18 21:24:09 +00:00
Thomas Heller 153038efa4 Issue #1642: Fix segfault in ctypes when trying to delete attributes. 2007-12-18 19:00:34 +00:00
Raymond Hettinger effde12f5f Speed-up dictionary constructor by about 10%.
New opcode, STORE_MAP saves the compiler from awkward stack manipulations
and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem.

Old disassembly:
              0 BUILD_MAP                0
              3 DUP_TOP
              4 LOAD_CONST               1 (1)
              7 ROT_TWO
              8 LOAD_CONST               2 ('x')
             11 STORE_SUBSCR
             12 DUP_TOP
             13 LOAD_CONST               3 (2)
             16 ROT_TWO
             17 LOAD_CONST               4 ('y')
             20 STORE_SUBSCR

New disassembly:
              0 BUILD_MAP                0
              3 LOAD_CONST               1 (1)
              6 LOAD_CONST               2 ('x')
              9 STORE_MAP
             10 LOAD_CONST               3 (2)
             13 LOAD_CONST               4 ('y')
             16 STORE_MAP
2007-12-18 18:26:18 +00:00
Christian Heimes bb89992211 Make it a bit easier to test Tcl/Tk and idle from a build dir. 2007-12-18 09:00:13 +00:00
Raymond Hettinger 88880b2dd6 Add more namedtuple() test cases. Neaten the code and comments. 2007-12-18 00:13:45 +00:00
Facundo Batista e64acfad3d Removed the private _rounding_decision: it was not needed, and the code
is now simpler.  Thanks Mark Dickinson.
2007-12-17 14:18:42 +00:00
Georg Brandl 9c8497eb6e Revert dummy commit now that the build slave is building. 2007-12-16 11:21:48 +00:00
Georg Brandl 6f6f6adea2 Dummy commit to investigate #1617. 2007-12-16 11:06:09 +00:00
Christian Heimes 17b52afda6 Fixed #1624: Remove output comparison for test_pep277
I had to modify Brett's patch slightly.
2007-12-15 05:38:35 +00:00
Christian Heimes c67a15d865 Fixed bug #1628
The detection now works on Unix with Makefile, Makefile with VPATH and on Windows.
2007-12-14 23:42:36 +00:00
Raymond Hettinger 07ae83f840 Faster and simpler _replace() method 2007-12-14 19:19:59 +00:00
Raymond Hettinger 48eca67ab9 Add line spacing for readability 2007-12-14 18:08:20 +00:00
Raymond Hettinger 42da874cdd Cleaner method naming convention 2007-12-14 02:49:47 +00:00
Christian Heimes 90e10e79ea Fixed bug #1620: New @spam.getter property syntax modifies the property in place.
I added also the feature that a @prop.getter decorator does not overwrite the doc string of the property if it was given as an argument to property().
2007-12-14 02:35:23 +00:00
Raymond Hettinger bc288e8bbd Small speedup 2007-12-13 23:52:59 +00:00
Raymond Hettinger 04a9a0e904 Simplify implementation of __replace__() 2007-12-13 22:55:52 +00:00
Christian Heimes 0a0e583259 Fixed bug #1613: Makefile's VPATH feature is broken 2007-12-13 19:23:16 +00:00
Alexandre Vassalotti 2f9ca29d10 Fix issue #1313119: urlparse "caches" parses regardless of encoding 2007-12-13 17:58:23 +00:00
Raymond Hettinger adf9ffdfbe Fix bug 1604. deque.__init__() did not clear existing contents like list.__init__. Not a backport candidate. 2007-12-13 00:08:37 +00:00
Kurt B. Kaiser 7a634e6027 IDLE_tabbedpages.071101.patch Tal Einat
Cosmetic changes, one bug.  Remove tabpage.py, replaced by tabbedpages.py
2007-12-11 19:35:12 +00:00
Christian Heimes f15c66e143 The new float repr causes too much trouble and pain. I'm disabling the feature until we have sorted out the issues on all machines. 64bit machines seem to have issues and Guido has reported even worse.
Guido: It's pretty bad actually -- repr(1e5) comes out as '1.0'... Ditto for
repr(1eN) for most N... Both in 2.6 and in 3.0...
2007-12-11 00:54:34 +00:00
Kurt B. Kaiser 0c64fb435a format_paragraph_event wasn't returning 'break' 2007-12-11 00:04:57 +00:00
Christian Heimes 284d927625 Backport of r59456:59458 from py3k to trunk
Issue #1580: New free format floating point representation based on "Floating-Point Printer Sample Code", by Robert G. Burger. For example repr(11./5) now returns '2.2' instead of '2.2000000000000002'.

Thanks to noam for the patch! I had to modify doubledigits.c slightly to support X64 and IA64 machines on Windows. I also added the new file to the three project files.
2007-12-10 22:28:56 +00:00
Guido van Rossum 8c3d0f7839 Remove a 2.2-ism. 2007-12-10 20:42:53 +00:00
Georg Brandl e6daafb449 Add DocXMLRPCServer test from GHOP task #136, written by Jeff Wheeler. 2007-12-09 22:39:12 +00:00
Georg Brandl 6113ce51b3 Two fixes in DocXMLRPCServer:
* remove parameter default that didn't make sense
* properly escape values in output
Thanks to Jeff Wheeler from GHOP!
2007-12-09 21:15:07 +00:00
Skip Montanaro 546624609e correct email address 2007-12-08 15:26:16 +00:00
Georg Brandl 26458c12a0 Fix tpyo. 2007-12-08 10:56:39 +00:00
Alexandre Vassalotti d8a8c7d8d7 Fix issue #1530.
Return an error exit status if not all tests passes.
2007-12-08 04:49:22 +00:00
Armin Rigo 66d41b2fae This is probably what was meant here. 2007-12-07 19:19:55 +00:00
Georg Brandl 5d1b4d44aa Increase unit test coverage of SimpleXMLRPCServer.
Written for GHOP by Turkay Eren.
2007-12-07 09:07:10 +00:00
Christian Heimes 0a5e54e732 Disabled one test that is failing on Unix 2007-12-06 13:55:01 +00:00
Christian Heimes d3fc07a4a0 Fixed get_config_h_filename for Windows. Without the patch it can't find the pyconfig.h file inside a build tree.
Added several small unit tests for sysconfig.
2007-12-06 13:15:13 +00:00
Raymond Hettinger 4e2f714031 Fix Issue 1045.
Factor-out common calling code by simplifying the length_hint API.
Speed-up the function by caching the PyObject_String for the attribute lookup.
2007-12-06 00:56:53 +00:00
Christian Heimes cbdb705c88 Fixed bug #1557 by using popen.communicate() before popen.wait() 2007-12-05 20:10:38 +00:00
Raymond Hettinger 2e1af256d4 Error checking was too aggressive (reported by Chris Tismer) 2007-12-05 18:11:08 +00:00
Christian Heimes 8f1fea5061 Fixed error in regrtest. I must have missed the spot. 2007-12-05 12:45:11 +00:00
Facundo Batista 58f6f2e0c9 fma speedup by avoiding to create a Context. Thanks Mark Dickinson. 2007-12-04 16:31:53 +00:00
Christian Heimes 44eeaec173 Patch #1537 from Chad Austin
Change GeneratorExit's base class from Exception to BaseException
(This time I'm applying the patch to the correct sandbox.)
2007-12-03 20:01:02 +00:00
Martin v. Löwis 6b449f4f2b Issue #1727780: Support loading pickles of random.Random objects created
on 32-bit systems on 64-bit systems, and vice versa. As a consequence
of the change, Random pickles created by Python 2.6 cannot be loaded
in Python 2.5.
2007-12-03 19:20:02 +00:00
Facundo Batista 2ec7415db5 Faster _fix function, and some reordering for a more elegant
coding. Thanks Mark Dickinson.
2007-12-03 17:55:00 +00:00
Facundo Batista 62edb71556 Speedup and cleaning of __str__. Thanks Mark Dickinson. 2007-12-03 16:29:52 +00:00
Christian Heimes 3305c52de7 Applied my patch #1455 with some extra fixes for VS 2005
The new msvc9compiler module supports VS 2005 and VS 2008. I've also fixed build_ext to support PCbuild8 and PCbuild9 and backported my fix for xxmodule.c from py3k. The old code msvccompiler is still in place in case somebody likes to build an extension with VS 2003 or earlier.
I've also updated the cygwin compiler module for VS 2005 and VS 2008. It works with VS 2005 but I'm unable to test it with VS 2008. We have to wait for a new version of cygwin.
2007-12-03 13:47:29 +00:00
Nick Coghlan ef01d822aa Implement PEP 366 2007-12-03 12:55:17 +00:00
Georg Brandl e4317fade8 Add test suite for cmd module.
Written by Michael Schneider for GHOP.
2007-12-01 22:38:48 +00:00
Lars Gustäbel 77b2d63b40 Issue #1531: Read fileobj from the current offset, do not seek to
the start.

(will backport to 2.5)
2007-12-01 21:02:12 +00:00
Christian Heimes dfdfaab1c5 Feature #1534
Added PyFloat_GetMax(), PyFloat_GetMin() and PyFloat_GetInfo() to the float API.
Added a dictionary sys.float_info with information about the internal floating point type to the sys module.
2007-12-01 11:20:10 +00:00
Christian Heimes 6b29dd05c8 Backport of -r59242:59246 from py3k
Fixed problem with regrtest caused by the additional of objects to _abcoll.
2007-11-30 22:36:10 +00:00
Amaury Forgeot d'Arc dafd32b730 Issue #1521: on 64bit platforms, str.decode fails on very long strings.
The t# and w# formats were not correctly handled.

Will backport.
2007-11-30 20:51:40 +00:00
Facundo Batista 0d157a0154 Reordering of __new__ to minimize isinstance() calls to most
used types. Thanks Mark Dickinson.
2007-11-30 17:15:25 +00:00
Amaury Forgeot d'Arc 025c347d61 Issue #1402: PyInterpreterState_Clear() may still invoke user code
(in deallocation of running threads, for example), so the PyGILState_Release()
function must still be functional.
On the other hand, _PyGILState_Fini() only frees memory, and can be called later.

Backport candidate, but only after some experts comment on it.
2007-11-29 23:35:25 +00:00
Christian Heimes 636afc52c0 I forgot to fix one occurence of new in test_descr 2007-11-27 23:53:14 +00:00
Christian Heimes 28104c58d2 Expose Py_Py3kWarningFlag as sys.py3kwarning as discussed in #1504
Also added a warning.warnpy3k() as convenient method for Python 3.x related deprecation warnings.
2007-11-27 23:16:44 +00:00
Guido van Rossum 715ec1818d Patch # 1507 by Mark Dickinson. Make complex(x, -0) retain the sign of
the imaginary part (as long as it's not complex).
Backport candidate?
2007-11-27 22:38:36 +00:00
Christian Heimes b61a1f5219 Added a deprecation warning to the 'new' module. 2007-11-27 21:35:44 +00:00
Christian Heimes c756d00cf2 Replaced import of the 'new' module with 'types' module and added a deprecation warning to the 'new' module. 2007-11-27 21:34:01 +00:00
Facundo Batista 2ffd780858 Moved the errno import from inside the functions to the
module level.  Fixes issue 1755179.
2007-11-27 18:50:12 +00:00
Skip Montanaro 58a6f446db back in these go - thanks to Titus Brown for the fix 2007-11-24 14:30:47 +00:00
Amaury Forgeot d'Arc ce7d10ccc4 Issue #1445: Fix a SystemError when accessing the ``cell_contents``
attribute of an empty cell object.  Now a ValueError is raised.
2007-11-24 13:44:17 +00:00
Skip Montanaro d3a1bdf4d9 revert change that breaks test_doctest (which I forgot to run - sorry) 2007-11-24 04:29:08 +00:00
Facundo Batista 9401cbe0e9 Test cases from Cowlishaw, v2.57. All are pased cleanly. 2007-11-23 18:14:50 +00:00
Facundo Batista 72bc54faed Major change in the internal structure of the Decimal
number: now it does not store the mantissa as a tuple
of numbers, but as a string.

This avoids a lot of conversions, and achieves a
speedup of 40%. The API remains intact.

Thanks Mark Dickinson.
2007-11-23 17:59:00 +00:00
Skip Montanaro 6d7914bf22 Make trace and doctest play nice together (issue 1429818). Will backport. 2007-11-23 17:08:35 +00:00
Brett Cannon eaa2c980ee Fix a bug in the test for using __loader__.get_data(). 2007-11-23 00:06:51 +00:00
Guido van Rossum 64c06e327d Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
With some changes of my own thrown in (e.g. backport of r58107).
2007-11-22 00:55:51 +00:00
Brett Cannon 9db1d5a379 Add a missing check before deleting a package's __loader__. 2007-11-21 00:58:03 +00:00
Brett Cannon 43e53f85b6 doctest assumed that a package's __loader__.get_data() method used universal
newlines; it doesn't.  To rectify this the string returned replaces all
instances of os.linesep with '\n' to fake universal newline support.

Backport candidate.
2007-11-21 00:47:36 +00:00
Brett Cannon 0e5edf5afd Remove a unneeded line that had typos. 2007-11-21 00:16:20 +00:00
Amaury Forgeot d'Arc 5087980c1e The incremental decoder for utf-7 must preserve its state between calls.
Solves issue1460.

Might not be a backport candidate: a new API function was added,
and some code may rely on details in utf-7.py.
2007-11-20 23:31:27 +00:00
Christian Heimes 547867e13a Another fix for test_shutil. Martin pointed out that it breaks some build bots 2007-11-20 03:21:02 +00:00
Christian Heimes 044d709111 Fixed bug #1470 2007-11-20 01:48:48 +00:00
Guido van Rossum 4673e19d8b Fix the OSX failures in this test -- they were due to /tmp being a symlink
to /private/tmp.  Adding a call to os.path.realpath() to temp_dir() fixed it.
2007-11-19 17:50:22 +00:00
Guido van Rossum 089816ba0b Make this work stand-alone, too. 2007-11-19 17:35:24 +00:00
Nick Coghlan 8f6793b540 Enable some test_cmd_line_script debugging output to investigate failure on Mac OSX buildbot 2007-11-19 13:56:27 +00:00
Walter Dörwald 183744d6b9 Fix for #1444: utf_8_sig.StreamReader was (indirectly through decode())
calling codecs.utf_8_decode() with final==True, which falled with incomplete
byte sequences. Fix and test by James G. Sack.
2007-11-19 12:41:10 +00:00
Walter Dörwald fc7e72d1c6 Fix typo in comment. 2007-11-19 12:14:05 +00:00
Nick Coghlan 327a39b047 Patch #1739468: Directories and zipfiles containing __main__.py are now executable 2007-11-18 11:56:28 +00:00
Facundo Batista 57d5669f4b Now in find, rfind, index, and rindex, you can use None as defaults,
as usual with slicing (both with str and unicode strings).  This
fixes issue 1259.

For str only the stringobject.c file was modified.  But for unicode,
I needed to repeat in the four functions a lot of code, so created
a new function that does part of the job for them (and placed it in
find.h, following a suggestion of Barry).

Also added tests for this behaviour.
2007-11-16 18:04:14 +00:00
Bill Janssen 414c2b0819 add the certificate for the Python SVN repository for testing SSL 2007-11-15 23:03:03 +00:00
Raymond Hettinger 5681cbce81 Small improvement to the implementation of __replace__(). 2007-11-15 02:55:42 +00:00
Raymond Hettinger eeeb9c4445 Accept Issac Morland's suggestion for __replace__ to allow multiple replacements
(suprisingly, this simplifies the signature, improves clarity, and is comparably fast).
Update the docs to reflect a previous change to the function name.
Add an example to the docs showing how to override the default __repr__ method.
2007-11-15 02:44:53 +00:00
Raymond Hettinger b5e5d0741a Add test for __fields__ being read-only 2007-11-14 23:02:30 +00:00
Raymond Hettinger 78f27e001b Make __fields__ read-only. Suggested by Issac Morland 2007-11-14 22:56:16 +00:00
Amaury Forgeot d'Arc 0d75f09177 Merge from py3k branch:
Correction for issue1265 (pdb bug with "with" statement).

When an unfinished generator-iterator is garbage collected, PyEval_EvalFrameEx
is called with a GeneratorExit exception set.  This leads to funny results
if the sys.settrace function itself makes use of generators.
A visible effect is that the settrace function is reset to None.
Another is that the eventual "finally" block of the generator is not called.

It is necessary to save/restore the exception around the call to the trace
function.

This happens a lot with py3k: isinstance() of an ABCMeta instance runs
    def __instancecheck__(cls, instance):
        """Override for isinstance(instance, cls)."""
        return any(cls.__subclasscheck__(c)
                   for c in {instance.__class__, type(instance)})
which lets an opened generator expression each time it returns True.

Backport candidate, even if the case is less frequent in 2.5.
2007-11-13 21:54:28 +00:00
Guido van Rossum 0288cb0ba8 Add the test from issue 1704621 (the issue itself is already fixed here). 2007-11-12 20:06:40 +00:00
Walter Dörwald edc526c161 Fix TextCalendar.prweek(). This closes issue #1427. 2007-11-12 10:01:33 +00:00
Christian Heimes ced1646b9e Fix for #1427: Error in standard module calendar
the prweek() method is still broken and I can't figure out how it suppose to work.
2007-11-12 01:20:56 +00:00
Vinay Sajip 95dd03b8b8 Fixed a bug reported (in private email, by Robert Crida) in logging configuration whereby child loggers of a logger named in a configuration file, which are not themselves named in the configuration, are disabled when the configuration is applied. 2007-11-11 14:27:30 +00:00
Guido van Rossum d1ef78942a Issue 1416. Add getter, setter, deleter methods to properties that can be
used as decorators to create fully-populated properties.
2007-11-10 22:12:24 +00:00
Georg Brandl 980c4fc04d Correct a comment about testing methods - nowadays most
tests don't run directly on import.
2007-11-09 17:33:23 +00:00
Raymond Hettinger 1760c8a017 Add set.isdisjoint() 2007-11-08 02:52:43 +00:00
Raymond Hettinger cdcf887999 Optimize dict.fromkeys() with dict inputs. Useful for resetting bag/muliset counts for example. 2007-11-07 02:26:17 +00:00
Raymond Hettinger 12e94200c0 Fix marshal's incorrect handling of subclasses of builtin types (backport candidate). 2007-11-07 01:13:09 +00:00
Gregory P. Smith e1ac4f1930 Fixes Issue 1385: The hmac module now computes the correct hmac when using
hashes with a block size other than 64 bytes (such as sha384 and sha512).
2007-11-06 00:19:03 +00:00
Gregory P. Smith 80e95c142e * db->get_flags is only available in BerkeleyDB >= 4.2 2007-11-05 09:07:40 +00:00
Gregory P. Smith ac11e02143 Add the bsddb.db.DBEnv.lock_id_free method.
Improve test_lock's tempdir creation and cleanup.
2007-11-05 02:56:31 +00:00
Gregory P. Smith ec10a4a402 Fixes bug 477182 on pybsddb.sf.net. DB objects now load the flags and
pay attention to them when opening an existing database.  This means
that d[] behaves properly even on databases previously created with DB_DUP
or DB_DUPSORT flags to allow duplicate keys.

http://sourceforge.net/tracker/index.php?func=detail&aid=477182&group_id=13900&atid=113900

Do not backport, this bugfix could be considered an API change.
2007-11-05 02:32:26 +00:00
Brett Cannon b13f70df1b Add a missing quotation mark. 2007-11-03 06:47:02 +00:00
Thomas Heller 03fd077482 Enable the full ctypes c_longdouble tests again. 2007-11-02 19:11:23 +00:00
Nick Coghlan 3814a911aa Fix for bug 1705170 - contextmanager swallowing StopIteration (2.5 backport candidate) 2007-11-02 10:09:12 +00:00
Gregory P. Smith 6d331ca9a4 Undo revision 58533 58534 fixes. Those were a workaround for
a problem introduced by 58385.
2007-11-01 21:15:36 +00:00
Gregory P. Smith aae141a751 Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them.  Replace the errant strdup with a
malloc+memcpy.  Adds a unit test for the correct behavior.
2007-11-01 21:08:14 +00:00
Christian Heimes 4de2263616 Removed non ASCII text from test as requested by Guido. Sorry :/ 2007-11-01 20:11:06 +00:00
Christian Heimes e18f21c7d4 Backport of import tests for bug http://bugs.python.org/issue1293 and bug http://bugs.python.org/issue1342 2007-11-01 19:48:10 +00:00
Kurt B. Kaiser 20172f9b5d check in Tal Einat's update to tabpage.py
Patch 1612746

M    configDialog.py
M    NEWS.txt
AM   tabbedpages.py
2007-10-30 02:38:54 +00:00
Guido van Rossum dff51b2898 Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
2007-10-29 20:52:45 +00:00
Kurt B. Kaiser 60d58406d0 Add confirmation dialog before printing. Patch 1717170 Tal Einat. 2007-10-28 19:03:59 +00:00
Hye-Shik Chang ea684743da Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet) 2007-10-28 12:38:09 +00:00
Hye-Shik Chang a838a801f2 - Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
2007-10-28 11:19:02 +00:00
Georg Brandl dd1a8466f5 Fix new pop() method on os.environ on ignorecase-platforms. 2007-10-26 18:30:41 +00:00
Kurt B. Kaiser 1e45f80b22 1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
2007-10-26 00:10:09 +00:00
Kurt B. Kaiser aa8a96a159 Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
2007-10-25 22:43:45 +00:00
Georg Brandl 1a94ec2664 Bug #1287: make os.environ.pop() work as expected. 2007-10-24 21:40:38 +00:00
Thomas Heller e7becc5007 Added unittest for calling a function with paramflags (backport from py3k branch). 2007-10-24 19:50:45 +00:00
Facundo Batista f5ade63e91 Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
2007-10-24 19:11:08 +00:00
Vinay Sajip bababa3ecc Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__() 2007-10-24 10:47:06 +00:00
Raymond Hettinger 01a0957f06 Shorter name for namedtuple() 2007-10-23 20:37:41 +00:00
Guido van Rossum 910ab50091 Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
2007-10-23 19:25:41 +00:00
Travis E. Oliphant 8feafab346 Add phuang patch from Issue 708374 which adds offset parameter to mmap module. 2007-10-23 02:40:56 +00:00
Guido van Rossum 5e81270b22 Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
2007-10-22 16:27:19 +00:00
Georg Brandl fa6179701c Remove duplicate crasher. 2007-10-21 10:01:56 +00:00
Armin Rigo 1486182451 Add a crasher for the long-standing issue with closing a file
while another thread uses it.
2007-10-21 09:14:15 +00:00
Facundo Batista 9b5e23148b The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.

Test cases added for these issues. Thanks Mark Dickinson.
2007-10-19 19:25:57 +00:00
Gregory P. Smith 87fc9ad966 squelch the warning that this test is supposed to trigger. 2007-10-19 07:31:20 +00:00
Gregory P. Smith 3ef21cb7c6 A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
2007-10-18 16:32:02 +00:00
Gregory P. Smith f8a2a0b5a9 Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
2007-10-18 08:34:20 +00:00
Gregory P. Smith afed3a4552 cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion.  (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
2007-10-18 07:56:54 +00:00
Facundo Batista 7066590736 Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself.  When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length).  Added a test case for this
behaviour.
2007-10-18 03:16:03 +00:00
Armin Rigo a1e42e11d5 Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.

Backport candidate, possibly.
2007-10-17 18:46:37 +00:00
Raymond Hettinger abfd8dff3b More docs, error messages, and tests 2007-10-16 21:28:32 +00:00
Raymond Hettinger 050afbf214 Improve error messages 2007-10-16 19:18:30 +00:00
Armin Rigo ec5601945a test_bigbits was not testing what it seemed to. 2007-10-15 07:48:35 +00:00
Neal Norwitz d29f1d2241 Use unittest for assertions 2007-10-14 18:40:37 +00:00
Neal Norwitz 3884690d69 Don't raise a string exception, they don't work anymore. 2007-10-14 18:30:21 +00:00
Neal Norwitz 880605aafd Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)

Also simplifies (slightLy) the exception handling elsewhere.
2007-10-14 00:18:40 +00:00
Gregory P. Smith 5d743fd187 Fix an uncollectable reference leak in bsddb.db.DBShelf.append 2007-10-13 23:02:05 +00:00
Gregory P. Smith d40f126fff Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic.  Also adds a test case for RECNO dbs
to test_dbshelve.
2007-10-12 18:44:06 +00:00
Raymond Hettinger 3a0de08d54 Fix test of count.__repr__() to ignore the 'L' if the count is a long 2007-10-12 17:53:11 +00:00
Thomas Heller 7fee6dd2a3 On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version.  This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
2007-10-11 19:51:32 +00:00
Kurt B. Kaiser 631fee6235 show paste if > 80 columns. Patch 1659326 Tal Einat. 2007-10-10 01:06:47 +00:00
Kurt B. Kaiser cca976b11c Allow cursor color change w/o restart. Patch 1725576 Tal Einat. 2007-10-10 00:55:40 +00:00
Raymond Hettinger 68995867d5 Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques. 2007-10-10 00:26:46 +00:00
Kurt B. Kaiser c8f65e69da Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
2007-10-09 19:31:30 +00:00
Gregory P. Smith b7de61bf49 Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
2007-10-09 07:19:11 +00:00
Gregory P. Smith 10bed54ae2 Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
2007-10-09 06:50:43 +00:00
Raymond Hettinger 163f622c03 Make the error messages more specific 2007-10-09 01:36:23 +00:00
Raymond Hettinger a48a29947a Eliminate camelcase function name 2007-10-08 21:26:58 +00:00
Raymond Hettinger 0e1d606116 Better variable names 2007-10-08 10:11:51 +00:00
Raymond Hettinger 2115bbc4da Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
2007-10-08 09:14:28 +00:00
Georg Brandl a970c22166 Update docstring of sched, also remove an unused assignment. 2007-10-08 08:06:05 +00:00