Commit Graph

8112 Commits

Author SHA1 Message Date
Raymond Hettinger b34ef94d46 SF bug 557704: netrc module can't handle all passwords
Let netrc handle entries with login fields (mail servers for instance)
by having login default to ''.

Backport candidate.
2003-04-24 20:11:20 +00:00
Skip Montanaro bfcbfa7c46 move imports in Binary class to top level to avoid repeated imports.
use cStringIO if available.
2003-04-24 19:51:31 +00:00
Skip Montanaro fa012610c4 new method: has_function() - returns a boolean indicating whether the
argument function is available on the current platform
2003-04-24 19:49:23 +00:00
Skip Montanaro 8ed06da754 first cut at unittest version of re tests 2003-04-24 19:43:18 +00:00
Skip Montanaro d839ecdc81 if the test is run directly (__name__ == "__main__") don't actually require
particular resources
2003-04-24 19:06:57 +00:00
Skip Montanaro 142da98beb remove test_socketserver from the skip lists 2003-04-24 19:05:41 +00:00
Barry Warsaw c4acc2bd32 GNUTranslations:
__init__(): Removed since we no longer need the coerce flag.
    Message ids and strings are now always coerced to Unicode, /if/
    the catalog specified a charset parameter.

    gettext(), ngettext(): Since the message strings are Unicodes in
    the catalog, coerce back to encoded 8-bit strings on return.

    ugettext(), ungettext(): Coerce the message ids to Unicode when
    there's no entry for the id in the catalog.

Minor code cleanups; use booleans where appropriate.
2003-04-24 18:13:39 +00:00
Barry Warsaw edb155fda1 UnicodeTranslationsTest.setUp(): Removed the coerce flag to the
GNUTranslations constructor.
2003-04-24 18:08:13 +00:00
Raymond Hettinger 9928571f3f SF bug 665835: filter() treatment of str and tuple inconsistent
As a side issue on this bug, it was noted that list and tuple iterators
used macros to directly access containers and would not recognize
__getitem__ overrides.  If the method is overridden, the patch returns
a generic sequence iterator which calls the __getitem__ method; otherwise,
it returns a high custom iterator with direct access to container elements.
2003-04-24 16:52:47 +00:00
Andrew M. Kuchling 47c2ab6b54 Fix docstring typo 2003-04-24 16:36:49 +00:00
Thomas Heller 54aa5781d5 This test now uses the separate getargs_X functions from _testcapimodule. 2003-04-24 16:15:29 +00:00
Tim Peters 0eadaac7dc Whitespace normalization. 2003-04-24 16:02:54 +00:00
Barry Warsaw 0822ff7cca Get rid of some hard coded tabs 2003-04-24 15:58:47 +00:00
Raymond Hettinger 352f9477da SF patch 695710: fix bug 678519: cStringIO self iterator
(requested by GvR. patch contributed by Michael Stone)
2003-04-24 15:50:11 +00:00
Raymond Hettinger 024aaa1bfe SF Patch 549151: urllib2 POSTs on redirect
(contributed by John J Lee)
2003-04-24 15:32:12 +00:00
Andrew M. Kuchling 9f4eb6b719 [Patch #679505] Silence DeprecationWarning when testing rotor module 2003-04-24 13:18:25 +00:00
Marc-André Lemburg 366a0feb9a Reformatted a bit to remove the lengthy re.compile() from the function
definitions.
2003-04-24 11:46:35 +00:00
Marc-André Lemburg 246d847475 New module platform.py, submitted by Marc-Andre Lemburg.
There's no separate documentation for this module yet - apart from the
doc-strings which explain the APIs.
2003-04-24 11:36:11 +00:00
Raymond Hettinger f4cf76dd5e Revert the previous enhancement to the bytecode optimizer.
The additional code complexity and new NOP opcode were not worth it.
2003-04-24 05:45:23 +00:00
Brett Cannon 7d618c731c Fix docstring for URLOpener.retrieve() in regards to opening a local file 2003-04-24 02:43:20 +00:00
Walter Dörwald ce07c8a9bf Max OS X returns "*" as the password in grp.getgrall()
and "" in grep.getgrgid(). Adjust the test to work
around this problem. This should fix SF bug #724771.
2003-04-23 19:50:24 +00:00
Raymond Hettinger 6eca358695 SF 557704: netrc module can't handle all passwords
Expanded the range of allowable characters to include ascii punctuation.
Allows resource files to have a larger character set for passwords.
(Idea contributed by Bram Moolenaar.)
2003-04-23 18:59:54 +00:00
Neal Norwitz a256f7d36f Fix SF bug #723801, logging.setLoggerClass() doesn't support new-style classes 2003-04-23 13:12:19 +00:00
Neal Norwitz f297bd1937 SF patch #725904, Minor changes to logging from module author (Vinay Sajip)
- upgrade to version 0.4.8
2003-04-23 03:49:43 +00:00
Jack Jansen 2b4b5a54d6 Fix by Lars Gustaebel for bug 721871: don't get upset if the prefix
field contains garbage after the first NUL character.
2003-04-22 22:03:11 +00:00
Fred Drake b28271f24d Do a little more searching for the data file for the test: this allows
using a build directory just inside the source directory and saving
just one copy of the test data in the source tree, rather than having
a copy in each build directory.
2003-04-22 18:15:05 +00:00
Jeremy Hylton c8c8b94c59 Only produce a dotted module name when writing output to a separate
directory.
2003-04-22 15:35:51 +00:00
Jack Jansen d69b744531 If not icon file is specified use the default Python Applet icons.
Fixes 719303.
2003-04-22 14:33:48 +00:00
Jack Jansen 6432f78215 Only return a warning message about not all files being unpacked if there
were indeed files that weren't unpacked.
2003-04-22 13:56:19 +00:00
Walter Dörwald ecd2fdca0f Change test_pwd and test_grp so they can handle duplicate user
and group names. This should fix SF bug #724771.
2003-04-22 11:05:57 +00:00
Alex Martelli a70b19147f Adding new built-in function sum, with docs and tests. 2003-04-22 08:12:33 +00:00
Raymond Hettinger 060641d511 Improved the bytecode optimizer.
* Can now test for basic blocks.
* Optimize inverted comparisions.
* Optimize unary_not followed by a conditional jump.
* Added a new opcode, NOP, to keep code size constant.
* Applied NOP to previous transformations where appropriate.

Note, the NOP would not be necessary if other functions were
added to re-target jump addresses and update the co_lnotab mapping.
That would yield slightly faster and cleaner bytecode at the
expense of optimizer simplicity and of keeping it decoupled
from the line-numbering structure.
2003-04-22 06:49:11 +00:00
Jeremy Hylton dfbfe736ce Add helper function to get module name taking packages into account. 2003-04-21 22:49:17 +00:00
Jeremy Hylton 38732e1065 Holistic refactoring.
Remove "." in coverage output for lines with comments.
Silence complaints in coverage output about unexecuted docstrings.

Eliminate use of inspect module in favor of direct access to frame and
code objects.  We're in a trace function here:  Efficiency counts!

Remove unused code.  Reflow long lines.

Remove backwards compatibility for stored trace output from Zooko's
experiment to add calledfuncs to the pickled dict.

Move code to generate per-file coverage stats to a separate routine.

Replace use of parser module with call to compile.
2003-04-21 22:04:46 +00:00
Greg Ward 5549322c79 Test suite for optparse. This is a slightly-edited copy of
test/test_optik.py (rev 1.19) from the Optik CVS.
2003-04-21 02:41:25 +00:00
Greg Ward 2492fcf3b0 Update to Optik 1.4.1; here are the relevant bits of the change log:
* Fixed some long-hidden bugs revealed by the new PyUnit-based
    test suite (thanks to Johannes Gijsbers the new test suite,
    improved tests that caught the bugs, and the bug fixes).

  * Make store_true/store_false store True/False rather than 1/0.

Details available in Optik's CVS repository.
2003-04-21 02:40:34 +00:00
Gustavo Niemeyer be733ee7fb More work on bug #672491 and patch #712900.
I've applied a modified version of Greg Chapman's patch. I've included
the fixes without introducing the reorganization mentioned, for the sake
of stability. Also, the second fix mentioned in the patch don't fix the
mentioned problem anymore, because of the change introduced by patch
#720991 (by Greg as well). The new fix wasn't complicated though, and is
included as well.

As a note. It seems that there are other places that require the
"protection" of LASTMARK_SAVE()/LASTMARK_RESTORE(), and are just waiting
for someone to find how to break them. Particularly, I belive that every
recursion of SRE_MATCH() should be protected by these macros. I won't
do that right now since I'm not completely sure about this, and we don't
have much time for testing until the next release.
2003-04-20 07:35:44 +00:00
Gustavo Niemeyer 48f3dcc93e - Changed shlex.split() method to have more useful and
meaningful parameters.
2003-04-20 01:57:03 +00:00
Martin v. Löwis 153c9e493e Patch #553171: Add writeback parameter. Also add protocol parameter. 2003-04-19 20:59:03 +00:00
Guido van Rossum aa86e35c52 - bool() called without arguments now returns False rather than
raising an exception.  This is consistent with calling the
  constructors for the other builtin types -- called without argument
  they all return the false value of that type.  (SF patch #724135)
  Thanks to Alex Martelli.
2003-04-19 18:15:10 +00:00
Guido van Rossum a26854095b - Several methods of nntplib.NNTP have grown an optional file argument
which specifies a file where to divert the command's output
  (already supported by the body() method).  (SF patch #720468)
  Thanks to Terry Carroll.
2003-04-19 18:04:57 +00:00
Mark Hammond 8d98d2cb95 New PyGILState_ API - implements pep 311, from patch 684256. 2003-04-19 15:41:53 +00:00
Martin v. Löwis b4cb664df4 New file. 2003-04-19 12:57:57 +00:00
Martin v. Löwis 78e2f06cc6 Fully support 32-bit codes. Enable BIGCHARSET in UCS-4 builds. 2003-04-19 12:56:08 +00:00
Martin v. Löwis 53d93adc46 Patch #681152: Support escaped Unicode characters in classes. Fixes #612074.
Will backport to 2.2.
2003-04-19 08:37:24 +00:00
Brett Cannon 1e91d8eb03 Make _strptime escape regex syntax in format string to prevent use in internal regex. 2003-04-19 04:00:56 +00:00
Barry Warsaw 482c5f7eb7 as_string(): Added some text to the docstring to make it clear that
it's a convenience only and give hints on what to do for more
flexibility.
2003-04-18 23:04:35 +00:00
Martin v. Löwis 281b2c6211 Patch #536883: SimpleXMLRPCServer auto-docing subclass. 2003-04-18 21:04:39 +00:00
Martin v. Löwis b5c4b7be3f Skip nameprep test 3.43, as we do allow unassigned characters. The test
fails only in UCS-2 mode, since it tests a non-BMP character.
2003-04-18 20:21:00 +00:00
Jason Tishler d7e83a1d51 Patch #718049: Setting exe_extension for cygwin
On cygwin, the setup.py script uses unixccompiler.py for compiling and linking
C extensions. The unixccompiler.py script assumes that executables do not get
special extensions, which makes sense for Unix.  However, on Cygwin,
executables get an .exe extension.

This causes a problem during the configuration step (python setup.py config),
in which some temporary executables may be generated. As unixccompiler.py does
not know about the .exe extension, distutils fails to clean up after itself: it
does not remove _configtest.exe but tries to remove _configtest instead.

The attached patch to unixccompiler.py sets the correct exe_extension for
cygwin by checking if sys.platform is 'cygwin'. With this patch, distutils
cleans up after itself correctly.

Michiel de Hoon
University of Tokyo, Human Genome Center.
2003-04-18 17:27:47 +00:00
Martin v. Löwis 2548c730c1 Implement IDNA (Internationalized Domain Names in Applications). 2003-04-18 10:39:54 +00:00
Guido van Rossum bbb931bebd Delete the 'h' test -- 'h' is no longer unsigned so the machinery here
can't test it.  It's unchanged so why would we test it anyway...
2003-04-18 00:13:53 +00:00
Neal Norwitz 10cf21802d Use True in a few more places.
Use isinstance(somestring, basestring) instead of type() as per PEP 8
2003-04-17 23:09:08 +00:00
Neal Norwitz aa1ac546b6 Get test to work under regrtest when running whole suite 2003-04-17 23:04:22 +00:00
Fred Drake fafd56f439 Add test that demonstrates SGML-style handling of processing
instructions.
2003-04-17 22:19:26 +00:00
Fred Drake 243152384b - use Tue/False for booleans
- some very minor cleanups
2003-04-17 22:01:17 +00:00
Gustavo Niemeyer 68d8cef89a Implemented posix-mode parsing support in shlex.py, as dicussed in
mailing list, and in patch #722686.
2003-04-17 21:31:33 +00:00
Thomas Heller a4ea603b05 SF # 595026: support for masks in getargs.c.
New functions:
  unsigned long PyInt_AsUnsignedLongMask(PyObject *);
  unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);
  unsigned long PyLong_AsUnsignedLongMask(PyObject *);
  unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);

New and changed format codes:

b unsigned char 0..UCHAR_MAX
B unsigned char none **
h unsigned short 0..USHRT_MAX
H unsigned short none **
i int INT_MIN..INT_MAX
I * unsigned int 0..UINT_MAX
l long LONG_MIN..LONG_MAX
k * unsigned long none
L long long LLONG_MIN..LLONG_MAX
K * unsigned long long none

Notes:

* New format codes.

** Changed from previous "range-and-a-half" to "none"; the
range-and-a-half checking wasn't particularly useful.

New test test_getargs2.py, to verify all this.
2003-04-17 18:55:45 +00:00
Neal Norwitz 6e5be22d97 Remove extra space in docstring 2003-04-17 13:13:55 +00:00
Guido van Rossum 2cd0a65c70 Add 'get' method to Variable and switch it from internal class to
standard class (it is now useful because it doesn't constrain the type
of the value).
2003-04-16 20:10:03 +00:00
Guido van Rossum a4541a30fc - super() no longer ignores data descriptors, except __class__. See
the thread started at
  http://mail.python.org/pipermail/python-dev/2003-April/034338.html
2003-04-16 20:02:22 +00:00
Martin v. Löwis bfe175c190 For StringVar results to strings. Document that boolean things are of
type bool. Requested in #721171.
2003-04-16 19:42:51 +00:00
Jack Jansen be5d707926 When on MacOSX, and only in a framework build, add
~/Library/Python/2.3/site-packages to sys.path, if it exists.
2003-04-16 13:12:21 +00:00
Jack Jansen 36d49a907f The identify() description didn't match the code. Fixed. 2003-04-16 13:10:53 +00:00
Jack Jansen 20fa6754d1 Allow switching of install dir after creation of preferences.
Changed some message to be clearer when presented by Package Manager.
2003-04-16 12:15:34 +00:00
Walter Dörwald 5688b7ac3e Add two dictionaries to htmlentitydefs: name2codepoint maps
HTML entity names to Unicode codepoints (as integers).
codepoint2name is the reverse mapping. From SF patch #722017.
2003-04-16 09:46:13 +00:00
Jack Jansen a95eab5920 Test SystemEvents too. 2003-04-15 21:40:30 +00:00
Guido van Rossum 52b2705e9c Ouch, it's Carlo Verre, not Verre Carlo. 2003-04-15 20:05:10 +00:00
Walter Dörwald 357981e99d Add a few errors tests for range(). 2003-04-15 18:59:28 +00:00
Walter Dörwald 64976e74af Fix copy & paste error in comment. 2003-04-15 16:08:01 +00:00
Walter Dörwald 43bc1f18db Fix the test so that it works even when /etc/group has two entries
for the same gid.
2003-04-15 15:59:36 +00:00
Walter Dörwald 66e1e508b9 Fix the test so that it works even when /etc/passwd has two entries
for the same uid.
2003-04-15 15:39:08 +00:00
Jack Jansen 6fde1cef4a - Use the tarfile module to unpack tarfiles.
- Allow setting the destination install directory. If this is set then
  it is used for the modules, other items (header files, etc) are not
  installed, and warnings are printed if the package would have liked to.

Unfortunaltey binary installs seem broken due to a tarfile bug (#721871)
or my misunderstanding of how tarfile works.
2003-04-15 14:43:05 +00:00
Tim Peters 299b3dffd2 test_range(): The C code changed to raise TypeError in one of these
cases, but the test still expected ValueError.  Repaired that.
2003-04-15 14:40:03 +00:00
Walter Dörwald b1ded1e508 Port test_pwd.py to PyUnit. Check that getpwall() and
getpwnam()/getpwuid() return consistent data.

Change test_grp to check that getgrall() and
getgrnam()/getgrgid() return consistent data.
Add error checks similar to test_pwd.py.

Port test___all__.py to PyUnit.

From SF patch #662807.
2003-04-15 11:10:33 +00:00
Guido van Rossum 8b7a9a38c6 The date class is now properly subclassable. (SF bug #720908)
(This is only the tip of the iceberg; the time and datetime classes
need the same treatment.)
2003-04-14 22:01:58 +00:00
Guido van Rossum 4dcdb78c6f Close off the "Verre Carlo hack" as discussed on python-dev. 2003-04-14 21:46:03 +00:00
Guido van Rossum 3a3cca5b82 - list.insert(i, x) now interprets negative i as it would be
interpreted by slicing, so negative values count from the end of the
  list.  This was the only place where such an interpretation was not
  placed on a list index.
2003-04-14 20:58:14 +00:00
Guido van Rossum 41c99e7f96 SF patch #720991 by Gary Herron:
A small fix for bug #545855 and Greg Chapman's
addition of op code SRE_OP_MIN_REPEAT_ONE for
eliminating recursion on simple uses of pattern '*?' on a
long string.
2003-04-14 17:59:34 +00:00
Jason Tishler 21664d854f Patch #709178: remove -static option from cygwinccompiler
After some more reflection (and no negative feedback), I am reverting the
original patch and applying my version, cygwinccompiler.py-shared.diff,
instead.

My reasons are the following:

1. support for older toolchains is retained
2. support for new toolchains (i.e., ld -shared) is added

The goal of my approach is to avoid breaking older toolchains while adding
better support for newer ones.
2003-04-14 12:51:26 +00:00
Neal Norwitz ae323198e5 Get test working if gzip support is not available 2003-04-14 01:18:32 +00:00
Jack Jansen 3576066cad Oops, _propdeclarations and friends are needed: gensuitemodule uses them
to lookup properties declared in base classes. Looking at it I'm not sure
what the official scope if the property codes is, maybe it is only the
(OSA) class in which they are used. But giving them global scope hasn't been
a problem so far.

Regenerated the standard suites, which are now also space-indented.
2003-04-12 22:27:11 +00:00
Barry Warsaw 6008cbd4c2 NullTranslations.__init__(): Back out of setting the default charset
to iso-8859-1.

GNUTranslations._parse(): Back out the addition of a test for
Project-ID-Version in the metadata.  This was deliberately removed in
response to SF patch #700839.

Also, re-organize the code in _parse() so we parse the metadata header
containing the charset parameter before we try to decode any strings
using charset.
2003-04-11 20:26:47 +00:00
Guido van Rossum efbbb1c602 Patch by Chad Netzer (with significant change):
- range() now works even if the arguments are longs with magnitude
  larger than sys.maxint, as long as the total length of the sequence
  fits.  E.g., range(2**100, 2**101, 2**100) is the following list:
  [1267650600228229401496703205376L].  (SF patch #707427.)
2003-04-11 18:43:06 +00:00
Barry Warsaw a1ce93f87c From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
- Expose NullTranslations and GNUTranslations to __all__

- Set the default charset to iso-8859-1.  It used to be None, which
would cause problems with .ugettext() if the file had no charset
parameter.  Arguably, the po/mo file would be broken, but I still think
iso-8859-1 is a reasonable default.

- Add a "coerce" default argument to GNUTranslations's constructor.  The
reason for this is that in Zope, we want all msgids and msgstrs to be
Unicode.  For the latter, we could use .ugettext() but there isn't
currently a mechanism for Unicode-ifying msgids.

The plan then is that the charset parameter specifies the encoding for
both the msgids and msgstrs, and both are decoded to Unicode when read.
For example, we might encode po files with utf-8. I think the GNU
gettext tools don't care.

Since this could potentially break code [*] that wants to use the
encoded interface .gettext(), the constructor flag is added, defaulting
to False.  Most code I suspect will want to set this to True and use
.ugettext().

- A few other minor changes from the Zope project, including asserting
that a zero-length msgid must have a Project-ID-Version header for it to
be counted as the metadata record.
2003-04-11 18:36:43 +00:00
Neal Norwitz 7f2588c073 SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Update configure and test to use proper timezone specifications
2003-04-11 15:35:53 +00:00
Fred Drake 126f2b76b9 Avoid creating one of the TestSuite objects. 2003-04-11 15:14:05 +00:00
Neal Norwitz 4ec6824896 Fix test_tarfile failure when gzip is not available
The module would exist, but be empty if already imported.
This change ensures we have gzip available.
2003-04-11 03:05:56 +00:00
Neal Norwitz ffe33b7f24 Attempt to make all the various string *strip methods the same.
* Doc - add doc for when functions were added
 * UserString
 * string object methods
 * string module functions
'chars' is used for the last parameter everywhere.

These changes will be backported, since part of the changes
have already been made, but they were inconsistent.
2003-04-10 22:35:32 +00:00
Skip Montanaro 594adac0bf hoist contents of csv submodule up to the package level 2003-04-10 17:16:15 +00:00
Jason Tishler dcae0dc4ed Patch #718551: cygwinccompiler.get_versions() patch
The cygwinccompiler.get_versions() function only handles versions numbers of
the form "x.y.z".  The attached patch enhances get_versions() to handle "x.y"
too (i.e., the ".z" is optional).

This change causes the unnecessary "--entry _DllMain@12" link option to be
suppressed for recent Cygwin and Mingw toolchains. Additionally, it directs
recent Mingw toolchains to use gcc instead of dllwrap during linking.
2003-04-09 20:13:59 +00:00
Guido van Rossum 11d204ca27 Add test for MessageBeep() 2003-04-09 19:57:06 +00:00
Guido van Rossum ed538d8b39 Detabified.
Removed dead code.
2003-04-09 19:36:34 +00:00
Guido van Rossum a12fe4e81f - New function sys.call_tracing() allows pdb to debug code
recursively.
- pdb has a new command, "debug", which lets you step through
  arbitrary code from the debugger's (pdb) prompt.
2003-04-09 19:06:21 +00:00
Jason Tishler 70367d3a6c Patch #709178: remove -static option from cygwinccompiler
Currently, the cygwinccompiler.py compiler handling in
distutils is invoking the cygwin and mingw compilers
with the -static option.

Logically, this means that the linker should choose to
link to static libraries instead of shared/dynamically
linked libraries.

Current win32 binutils expect import libraries to have
a .dll.a suffix and static libraries to have .a suffix.
If -static is passed, it will skip the .dll.a
libraries. This is pain if one has a tree with both
static and dynamic libraries using this naming
convention, and wish to use the dynamic libraries.

The -static option being passed in distutils is to get
around a bug in old versions of binutils where it would
get confused when it found the DLLs themselves.

The decision to use static or shared libraries is site
or package specific, and should be left to the setup
script or to command line options.
2003-04-09 16:03:57 +00:00
Jack Jansen 0ae3220736 Detabbed. 2003-04-09 13:25:43 +00:00
Andrew M. Kuchling 058a84f36a Remove the --verify option in favor of the standard -n/--dry-run option 2003-04-09 12:35:51 +00:00
Skip Montanaro cfd55501bb add a #! line for unix weenies 2003-04-08 19:49:40 +00:00
Tim Peters 8805e66ec8 New tests identical to boom and boom2, except using new-style classes.
These never failed in 2.3, and the tests confirm it.  They still blow up
in the 2.2 branch, despite that all the gc-vs-__del__ fixes from 2.3
have been backported (and this is expected -- 2.2 needs more work than
2.3 needed).
2003-04-08 19:44:13 +00:00
Skip Montanaro fb2a6ccfc4 correct a couple docstring nits 2003-04-08 19:40:19 +00:00