Commit Graph

12457 Commits

Author SHA1 Message Date
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
Neal Norwitz 92abad24d6 Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
2007-10-06 19:16:28 +00:00
Gregory P. Smith 71e4fb5877 Use the host the author likely meant in the first place. pop.gmail.com is
reliable.  gmail.org is someones personal domain.
2007-10-06 15:47:37 +00:00
Raymond Hettinger a7fc4b13e0 Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__().  The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
2007-10-05 02:47:07 +00:00
Kurt B. Kaiser e3fde8f8cd configDialog cleanup. Patch 1730217 Tal Einat. 2007-10-04 03:11:12 +00:00
Kurt B. Kaiser d5f4910afd textView cleanup. Patch 1718043 Tal Einat.
M    idlelib/EditorWindow.py
M    idlelib/aboutDialog.py
M    idlelib/textView.py
M    idlelib/NEWS.txt
2007-10-04 02:53:07 +00:00
Kurt B. Kaiser 0b634efcbc Clean up EditorWindow close. 2007-10-04 02:09:17 +00:00
Kurt B. Kaiser 85897c9b38 Remove unused theme that was causing a fault in p3k. 2007-10-04 02:07:50 +00:00
Kurt B. Kaiser 67bd62fd6c Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
2007-10-04 01:49:54 +00:00
Raymond Hettinger 50e90e265f itertools.count() no longer limited to sys.maxint. 2007-10-04 00:20:27 +00:00
Facundo Batista be6c7ba72a Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing.  Thanks Mark Dickinson
2007-10-02 18:21:18 +00:00
Facundo Batista 1a191df14d Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.

Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).

Thanks Mark Dickinson
2007-10-02 17:01:24 +00:00
Vinay Sajip c537881caa Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time. 2007-09-27 07:35:10 +00:00
Vinay Sajip 66ba9ffcb1 Minor date change. 2007-09-27 06:56:13 +00:00
Vinay Sajip 90d93615d6 Change to basicConfig() to fix #1021. 2007-09-27 05:38:51 +00:00
Vinay Sajip 4df367c08d Change to flush and close logic to fix #1760556. 2007-09-27 05:34:45 +00:00
Georg Brandl 9b915673b7 #1177: accept 2xx responses for https too, not only http. 2007-09-24 18:08:24 +00:00
Guido van Rossum ad8fb0d47c Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
2007-09-22 20:18:03 +00:00
Georg Brandl 4a21268a74 Patch #1181: add os.environ.clear() method. 2007-09-20 17:57:59 +00:00
Georg Brandl aff85e2d26 Patch #1541463: optimize performance of cgi.FieldStorage operations. 2007-09-20 16:06:07 +00:00
Facundo Batista 8c20244069 Issue #1772851. Optimization of __hash__ to behave better for big big
numbers.
2007-09-19 17:53:25 +00:00
Thomas Wouters b3e6e8c895 Fix obvious typo in threaded test. 2007-09-19 17:27:29 +00:00
Facundo Batista d544df7ddd Issue #1772851. Alters long.__hash__ from being *almost* completely
predictable to being completely predictable.  The value of hash(n)
is unchanged for any n that's small enough to be representable as an
int, and also unchanged for the vast majority of long integers n of
reasonable size.
2007-09-19 15:10:06 +00:00
Sean Reifscheider a1afbf617d issue1177: Ported Facundo's from urllib2 to urllib, accepting 2xx responses. 2007-09-19 07:52:56 +00:00
Facundo Batista cce8df2f67 Speed up of the various division operations (remainder, divide,
divideint and divmod). Thanks Mark Dickinson.
2007-09-18 16:53:18 +00:00
Raymond Hettinger 2b03d45bb9 Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. 2007-09-18 03:33:19 +00:00
Sean Reifscheider f09597c1fd issue1082: Fixing platform and system for Vista. 2007-09-17 20:53:21 +00:00
Facundo Batista 6c398da0e7 The methods always return Decimal classes, even if they're
executed through a subclass (thanks Mark Dickinson).
Added a bit of testing for this.
2007-09-17 17:30:13 +00:00
Raymond Hettinger d36a60e1e3 Sync-up named tuples with the latest version of the ASPN recipe.
Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries).
Adds the __fields__ attribute for introspection and to support conversion to dictionary form.
Adds a  __replace__() method similar to str.replace() but using a named field as a target.
Clean-up spelling and presentation in doc-strings.
2007-09-17 00:55:00 +00:00
Bill Janssen bf10c47389 use binary mode when reading files for testAsyncore to make Windows happy 2007-09-16 23:16:46 +00:00
Bill Janssen 296a59d3be Add support for asyncore server-side SSL support. This requires
adding the 'makefile' method to ssl.SSLSocket, and importing the
requisite fakefile class from socket.py, and making the appropriate
changes to it to make it use the SSL connection.

Added sample HTTPS server to test_ssl.py, and test that uses it.

Change SSL tests to use https://svn.python.org/, instead of
www.sf.net and pop.gmail.com.

Added utility function to ssl module, get_server_certificate,
to wrap up the several things to be done to pull a certificate
from a remote server.
2007-09-16 22:06:00 +00:00
Thomas Heller a7f49f733b ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Fixes issue #1777530; will backport to release25-maint.
2007-09-14 19:40:35 +00:00
Facundo Batista bd2fe839db Put the parameter watchexp back in (changed watchexp from an int
to a bool).  Also second argument to watchexp is now converted
to Decimal, just as with all the other two-argument operations.

Thanks Mark Dickinson.
2007-09-13 18:42:09 +00:00
Facundo Batista 353750c405 Merged the decimal-branch (revisions 54886 to 58140). Decimal is now
fully updated to the latests Decimal Specification (v1.66) and the
latests test cases (v2.56).

Thanks to Mark Dickinson for all his help during this process.
2007-09-13 18:13:15 +00:00
Georg Brandl aef205d1a8 #1120: put explicit version in the shebang lines of pydoc, idle
and smtpd.py scripts that are installed by setup.py. That way, they
work when only "make altinstall" is used.
2007-09-12 19:29:28 +00:00
Georg Brandl 8fd3ecf928 Bug #1153: repr.repr() now doesn't require set and dictionary items
to be orderable to properly represent them.
2007-09-12 19:00:07 +00:00
Bill Janssen c28d5fb456 root certificate for https://svn.python.org/, used in test_ssl 2007-09-12 18:52:05 +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
Thomas Heller 0b7120258a Disable some tests that fail on the 'ppc Debian unstable' buildbot to
find out if they cause the segfault on the 'alpha Debian' machine.
2007-09-11 19:17:48 +00:00
Nick Coghlan 1df42b118c Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) 2007-09-11 14:01:18 +00:00
Bill Janssen e3f1d7d059 Make sure test_ssl doesn't reference the ssl module in a
context where it can't be imported.
2007-09-11 01:09:19 +00:00
Bill Janssen 119c7a623a A better way of finding an open port to test with. 2007-09-10 23:41:24 +00:00
Guido van Rossum b55911378f Patch # 1026 by Benjamin Aranguren (with Alex Martelli):
Backport abc.py and isinstance/issubclass overloading to 2.6.

I had to backport test_typechecks.py myself, and make one small change
to abc.py to avoid duplicate work when x.__class__ and type(x) are the
same.
2007-09-10 22:36:02 +00:00
Guido van Rossum 1ff91d95a2 Patch # 1140 (my code, approved by Effbot).
Make sure the type of the return value of re.sub(x, y, z) is the type
of y+x (i.e. unicode if either is unicode, str if they are both str)
even if there are no substitutions or if x==z (which triggered various
special cases in join_list()).

Could be backported to 2.5; no need to port to 3.0.
2007-09-10 22:02:25 +00:00
Bill Janssen 98d19dafd9 More work on SSL support.
* Much expanded test suite:

  All protocols tested against all other protocols.
  All protocols tested with all certificate options.
  Tests for bad key and bad cert.
  Test of STARTTLS functionality.
  Test of RAND_* functions.

* Fixes for threading/malloc bug.

* Issue 1065 fixed:

  sslsocket class renamed to SSLSocket.
  sslerror class renamed to SSLError.
  Function "wrap_socket" now used to wrap an existing socket.

* Issue 1583946 finally fixed:

  Support for subjectAltName added.
  Subject name now returned as proper DN list of RDNs.

* SSLError exported from socket as "sslerror".

* RAND_* functions properly exported from ssl.py.

* Documentation improved:

  Example of how to create a self-signed certificate.
  Better indexing.
2007-09-10 21:51:02 +00:00
Brett Cannon a0c05512ec Fix a possible segfault from recursing too deep to get the repr of a list.
Closes issue #1096.
2007-09-10 21:38:27 +00:00
Martin v. Löwis 0a04819a13 tr a-z A-Z does not work on Solaris (would require
/usr/xpg4/bin/tr); make the character ranges explicit.
2007-09-10 06:18:32 +00:00
Gregory P. Smith e9fef694b4 Change socket.error to inherit from IOError rather than being a stand
alone class.  This addresses the primary concern in

 http://bugs.python.org/issue1706815

python-dev discussion here:

 http://mail.python.org/pipermail/python-dev/2007-July/073749.html

I chose IOError rather than EnvironmentError as the base class since
socket objects are often used as transparent duck typed file objects
in code already prepared to deal with IOError exceptions.

also a minor fix:

 urllib2 - fix a couple places where IOError was raised rather than URLError.
           for better or worse, URLError already inherits from IOError so
           this won't break any existing code.

 test_urllib2net - replace bad ftp urls.
2007-09-09 23:36:46 +00:00
Gregory P. Smith f80578548d email address update 2007-09-09 20:25:00 +00:00
Skip Montanaro 0539313b09 be explicit about the actual location of the missing file 2007-09-08 00:34:17 +00:00
Thomas Heller 2e638c3a8a Backport from py3k branch:
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler.  This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
2007-09-07 09:33:24 +00:00
Thomas Heller 2825b2ea44 Add a 'c_longdouble' type to the ctypes module. 2007-09-07 06:32:17 +00:00
Brett Cannon 1e534b5425 Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call().  Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
2007-09-07 04:18:30 +00:00
Brett Cannon 68a6da99e6 Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does
not.
2007-09-07 03:17:50 +00:00
Gregory P. Smith 161586c804 Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
2007-09-06 22:59:59 +00:00
Armin Rigo 337841dac7 PyDict_GetItem() returns a borrowed reference.
This attack is against ceval.c:IMPORT_NAME, which calls an
object (__builtin__.__import__) without holding a reference to it.
2007-09-06 09:30:38 +00:00
Armin Rigo 362bb51503 PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks
such as the following one, in bltinmodule.c:min_max().
2007-09-05 07:51:21 +00:00
Bill Janssen ffe576dc78 SSL certificate distinguished names should be represented by tuples 2007-09-05 00:46:27 +00:00
Martin v. Löwis a5136196bc Patch #1031213: Decode source line in SyntaxErrors back to its original
source encoding. Will backport to 2.5.
2007-09-04 14:19:28 +00:00
Georg Brandl 4cdceac760 Fix #883466: don't allow Unicode as arguments to quopri and uu codecs. 2007-09-03 07:16:46 +00:00
Bill Janssen 470dcd2611 remove use of non-existent SSLFakeSocket in apparently untested code 2007-08-31 19:03:31 +00:00
Bill Janssen 910fa59595 remove mentions of socket.ssl in comments 2007-08-31 19:02:46 +00:00
Bill Janssen c459264f5b deprecate use of FakeSocket 2007-08-31 19:02:23 +00:00
Thomas Wouters 628e3bb808 One more fix to consider missing SSL support. 2007-08-30 22:35:31 +00:00
Thomas Wouters a6900e8d72 Don't lie in __all__ attributes when SSL is not available: only add the SSL
classes when they are actually created.
2007-08-30 21:54:39 +00:00
Thomas Wouters dcb3c382ac Somewhat-preliminary slice-object and extended slicing support for ctypes.
The exact behaviour of omitted and negative indices for the Pointer type may
need a closer look (especially as it's subtly different from simple slices)
but there's time yet before 2.6, and not enough before 3.0a1 :-)
2007-08-30 21:01:17 +00:00
Martin v. Löwis 7dcb83cdc5 Bug #1709599: Run test_1565150 only if the file system is NTFS. 2007-08-30 19:04:09 +00:00
Bill Janssen 24bccf2e32 Added docstrings to methods and functions. 2007-08-30 17:07:28 +00:00
Georg Brandl 0226d85737 * Skip test_pipes on non-POSIX.
* Don't raise TestSkipped within a test function.
2007-08-30 12:32:23 +00:00
Georg Brandl 27d9ee32ab Patch #1680959: add test suite for pipes module. 2007-08-30 10:38:56 +00:00
Bill Janssen 426ea0a864 This contains a number of things:
1) Improve the documentation of the SSL module, with a fuller
   explanation of certificate usage, another reference, proper
   formatting of this and that.

2) Fix Windows bug in ssl.py, and general bug in sslsocket.close().
   Remove some unused code from ssl.py.  Allow accept() to be called on
   sslsocket sockets.

3) Use try-except-else in import of ssl in socket.py.  Deprecate use of
   socket.ssl().

4) Remove use of socket.ssl() in every library module, except for
   test_socket_ssl.py and test_ssl.py.
2007-08-29 22:35:05 +00:00
Facundo Batista 492e5920bc Ignore test failures caused by 'resource temporarily unavailable'
exceptions raised during FailingServerTestCase tests.
[GSoC - Alan McIntyre]
2007-08-29 10:28:28 +00:00
Walter Dörwald 6d20b705dd Fix test output. 2007-08-28 23:35:33 +00:00
Skip Montanaro 1a41313684 fixes 813986 2007-08-28 23:22:52 +00:00
Georg Brandl bf138333ce Add a crasher for the thread-unsafety of file objects. 2007-08-28 18:54:44 +00:00
Walter Dörwald f0d1c1f3ec Fix title endtag in HTMLCalender.formatyearpage(). Fix documentation for
HTMLCalender.formatyearpage() (there's no themonth parameter).

This fixes issue1046.
2007-08-28 16:38:26 +00:00
Thomas Wouters 3ccec68a05 Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
   is done for simple slices, in the tuple, string and unicode case.

 - Specialcase step-1 extended slices to optimize the common case for all
   involved types.

 - For lists, allow extended slice assignment of differing lengths as long
   as the step is 1. (Previously, 'l[:2:1] = []' failed even though
   'l[:2] = []' and 'l[:2:None] = []' do not.)

 - Implement extended slicing for buffer, array, structseq, mmap and
   UserString.UserString.

 - Implement slice-object support (but not non-step-1 slice assignment) for
   UserString.MutableString.

 - Add tests for all new functionality.
2007-08-28 15:28:19 +00:00
Lars Gustäbel 0f4a14b56f TarFile.__init__() no longer fails if no name argument is passed and
the fileobj argument has no usable name attribute (e.g. StringIO).

(will backport to 2.5)
2007-08-28 12:31:09 +00:00
Guido van Rossum d51b579c51 Patch # 1739906 by Christian Heimes -- add reduce to functools (importing
it from __builtin__).
2007-08-27 20:51:00 +00:00
Guido van Rossum ba8c5653cc > Regardless, building a fixed test certificate and checking it in sounds like
> the better option.  Then the openssl command in the test code can be turned
> into a comment describing how the test data was pregenerated.

Here's a patch that does that.

Bill
2007-08-27 17:19:42 +00:00
Facundo Batista f91ad6a5da Ignore test failures caused by 'resource temporarily unavailable'
exceptions raised in the test server thread, since SimpleXMLRPCServer
does not gracefully handle them.  Changed number of requests handled
by tests server thread to one (was 2) because no tests require more
than one request. [GSoC - Alan McIntyre]
2007-08-27 01:15:34 +00:00
Neal Norwitz 9eb9b10751 If we can't create a certificate, print a warning, but don't fail the test.
Modified patch from what Bill Janssen sent on python-3000.
2007-08-27 01:15:33 +00:00
Neal Norwitz 3e533c2290 Make a utility function for handling (printing) an error 2007-08-27 01:03:18 +00:00
Neal Norwitz f6f525b7c9 Stop using string.join (from the module) to ease upgrade to py3k 2007-08-27 00:58:33 +00:00
Neal Norwitz d6a51e64d7 Another patch from Bill Janssen that:
1)  Fixes the bug that two class names are initial-lower-case.
2)  Replaces the poll waiting for the server to become ready with
    a threading.Event signal.
2007-08-26 22:20:03 +00:00
Neal Norwitz 1b2f62d139 Catch IOError for when the device file doesn't exist or the user doesn't have
permission to write to the device.
2007-08-26 22:16:23 +00:00
Neal Norwitz 15d4e56c40 Get the test passing by commenting out some writes (should they be removed?) 2007-08-26 21:40:16 +00:00
Guido van Rossum e472933e27 Bill Janssen wrote:
Here's a patch which makes test_ssl a better player in the buildbots
environment.  I deep-ended on "try-except-else" clauses.
2007-08-26 19:35:09 +00:00
Neal Norwitz 7fc8e2993a Fail gracefully if the cert files cannot be created 2007-08-26 18:50:39 +00:00
Neal Norwitz 482043aed6 Reap children before the test starts so hopefully SocketServer
won't find any old children left around which causes an exception
in collect_children() and the test to fail.
2007-08-26 06:29:57 +00:00
Neal Norwitz 60b52bd4ed Fix typo in docstring (missing c in reacquire) 2007-08-26 01:08:16 +00:00
Neal Norwitz 8e58b34ee8 Try to get this test to pass for systems that do not have SO_REUSEPORT 2007-08-25 17:25:17 +00:00
Neal Norwitz ce7fa56aac Fix test so it is skipped properly if there is no SSL support. 2007-08-25 16:54:38 +00:00
Guido van Rossum 4f2c3ddca4 Server-side SSL and certificate validation, by Bill Janssen.
While cleaning up Bill's C style, I may have cleaned up some code
he didn't touch as well (in _ssl.c).
2007-08-25 15:08:43 +00:00
Nick Coghlan 1a42ece0c7 Fix bug 1764407 - the -i switch now does the right thing when using the -m switch 2007-08-25 10:50:41 +00:00
Nick Coghlan 3af0e785e7 Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) 2007-08-25 04:32:07 +00:00
Collin Winter 68f525fdc8 Make test_structmembers pass when run with regrtests's -R flag. 2007-08-24 21:09:42 +00:00
Georg Brandl c325556505 Port test_class to unittest. Patch #1671298. 2007-08-24 19:33:53 +00:00
Georg Brandl ff9b963387 Catch the correct errors. 2007-08-24 19:22:34 +00:00