Commit Graph

3496 Commits

Author SHA1 Message Date
Michael W. Hudson b2308bb9be Fix bug:
[ 1327110 ] wrong TypeError traceback in generator expressions

by removing the code that can stomp on the users' TypeError raised by the
iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly
reasonable message itself.  Also, a couple of tests.
2005-10-21 11:45:01 +00:00
Neal Norwitz 37c0844b35 Fix SF bug #1167751, Argument genexp corner case
Incorrect code was generated for:

  foo(a = i for i in range(10))

This should have generated a SyntaxError.  Fix the Grammar so
it raises a SyntaxError and test it.

I'm uncertain whether this should be backported.  It makes
something that was Syntactically valid invalid.  However,
the code would either be completely broken or do the wrong thing.
2005-10-21 06:24:02 +00:00
Neal Norwitz f21c8ed58a Add comment lost from AST merge 2005-10-21 04:34:18 +00:00
Jeremy Hylton 3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Jeremy Hylton bc2a62fcfd Disable some tests in anticipation of merging ast-branch to the head 2005-10-20 14:27:21 +00:00
Neal Norwitz b0e32e2b71 Fix SF bug # 1330039, patch # 1331635 from Lars Gustaebel (tarfile maintainer)
Problem: if two files are assigned the same inode
number by the filesystem, the second one will be added
as a hardlink to the first, which means that the
content will be lost.

The patched code checks if the file's st_nlink is
greater 1. So only for files that actually have several
links pointing to them hardlinks will be created, which
is what GNU tar does.

Will backport.
2005-10-20 04:50:13 +00:00
Raymond Hettinger 4b0f20def3 Teach unquote() to handle unicode inputs 2005-10-15 16:41:53 +00:00
Guido van Rossum c252c5964c Fix unit test failure -- the output received from Python can be empty,
but verify_valid_flag() wasn't expecting that.  Will backport.
2005-10-08 20:04:35 +00:00
Walter Dörwald d1c1e10f70 Part of SF patch #1313939: Speedup charmap decoding by extending
PyUnicode_DecodeCharmap() the accept a unicode string as the mapping
argument which is used as a mapping table.

This code isn't used by any of the codecs yet.
2005-10-06 20:29:57 +00:00
Raymond Hettinger cc9a951f35 SF #1313496: bisect C replacement doesn't accept named args 2005-10-05 11:39:12 +00:00
Neal Norwitz 11bd119226 SF bug #887946, segfault if redirecting directory
Also provide a warning if a directory is passed on the command line.
Add minimal command line test.

Will backport.
2005-10-03 00:54:56 +00:00
Neal Norwitz 40d3781416 - Fix segfault with invalid coding.
- SF Bug #772896, unknown encoding results in MemoryError, which is not helpful

I will only backport the segfault fix.  I'll let Anthony decide if he wants
the other changes backported.  I will do the backport if asked.
2005-10-02 01:48:49 +00:00
Neal Norwitz 484d9a409a Patch #1309009, Fix segfault in pyexpat when the XML document is
in latin_1, but Python incorrectly assumes it is in UTF-8 format

Will backport.
2005-09-30 04:46:49 +00:00
Armin Rigo dd5c023af5 some more fixes and tests for inspect.getsource(), triggered by crashes
from the PyPy project as well as the SF bug #1295909.
2005-09-25 11:45:45 +00:00
Raymond Hettinger 6b27cda643 Convert iterator __len__() methods to a private API. 2005-09-24 21:23:05 +00:00
Michael W. Hudson 10402a306f Patches #1298449 and #1298499: Add some missing checks for error
returns in cStringIO.c.  Thanks to Andrew Bennetts.

This must be a backport candidate.
2005-09-22 09:19:01 +00:00
Jack Jansen 19e11c86a7 MacOSX 10.4 apparently does not allow the creation time to be set to later
than the modification time. Changed the SetDates test to accomodate.

Backport candidate.
2005-09-21 20:52:11 +00:00
Armin Rigo f879024487 test and fix for buggy handling of exceptions raised by C functions,
causing the profiler to crash on an AssertionError if the same Python
function catches multiple exceptions from C functions.
2005-09-20 18:50:13 +00:00
Skip Montanaro f8948ca5d7 skip _locale test if OS X < 10.4 2005-09-19 03:54:46 +00:00
Georg Brandl 9e28107ce8 Test case for latest complexobject fix. 2005-09-17 07:51:15 +00:00
Raymond Hettinger 9bda1d6f64 No longer ignore exceptions raised by comparisons during key lookup.
Inspired by Armin Rigo's suggestion to do the same with dictionaries.
2005-09-16 07:14:21 +00:00
Brett Cannon a783d06f8c Clear out the regex cache when the TimeRE cache is invalidated by a locale
change.

Fixes bug #1290505.
2005-09-15 02:34:56 +00:00
Guido van Rossum 8ee3e5aa93 - Changes donated by Elemental Security to make it work on AIX 5.3
with IBM's 64-bit compiler (SF patch #1284289).  This also closes SF
  bug #105470: test_pwd fails on 64bit system (Opteron).
2005-09-14 18:09:42 +00:00
Gustavo Niemeyer 6fa0c5a452 Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than
considering it exactly like a '*'.
2005-09-14 08:54:39 +00:00
Raymond Hettinger 2bdec7bfb0 Revert 1.170. Add tests. 2005-09-10 14:30:09 +00:00
Walter Dörwald a47d1c08d0 SF bug #1251300: On UCS-4 builds the "unicode-internal" codec will now complain
about illegal code points. The codec now supports PEP 293 style error handlers.
(This is a variant of the Nik Haldimann's patch that detects truncated data)
2005-08-30 10:23:14 +00:00
Martin v. Löwis 5dbdc59577 Patch #1168594: set sizes of non-regular files to zero. Fixes #1167128.
Will backport to 2.4.
2005-08-27 10:07:56 +00:00
Tim Peters 9e34c04732 Whitespace normalization (via reindent.py). 2005-08-26 15:20:46 +00:00
Tim Peters e8889c5741 testSeekBackwardsFromEnd(): Repair obvious syntax error. 2005-08-26 14:33:57 +00:00
Georg Brandl d603c04bcd Add list() around xreadlines() 2005-08-26 13:23:54 +00:00
Georg Brandl 62fe585b4b *** empty log message *** 2005-08-26 13:21:50 +00:00
Georg Brandl 5a650a253c patch [ 810023 ] Fix for off-by-one bug in urllib.URLopener.retrieve 2005-08-26 08:51:34 +00:00
Georg Brandl d2e3ba7a35 patch [ 756021 ] Allow socket.inet_aton("255.255.255.255") on Windows 2005-08-26 08:34:00 +00:00
Georg Brandl 905a01aba4 bug [ 1262320 ] minidom.py alternate newl support is broken 2005-08-25 22:14:15 +00:00
Martin v. Löwis 8b59514e57 Make IDNA return an empty string when the input is empty. Fixes #1163178.
Will backport to 2.4.
2005-08-25 11:03:38 +00:00
Georg Brandl 8246c439a8 Correct test suite for #848017. 2005-08-25 07:32:42 +00:00
Georg Brandl e1b13d2019 Bug #735248: Fix urllib2.parse_http_list. 2005-08-24 22:20:32 +00:00
Georg Brandl be3856dcd4 patch [ 1141428 ] more __contains__ tests 2005-08-24 09:08:57 +00:00
Georg Brandl 52715f69e7 [ 1113421 ] New tutorial tests in test_generators.py 2005-08-24 09:02:29 +00:00
Georg Brandl 38387b8b91 bug [ 728515 ] mmap's resize method resizes the file in win32 but not unix 2005-08-24 07:17:40 +00:00
Gregory P. Smith f21a5f7739 [ sf.net patch # 1121611 ]
A new hashlib module to replace the md5 and sha modules.  It adds
support for additional secure hashes such as SHA-256 and SHA-512.  The
hashlib module uses OpenSSL for fast platform optimized
implementations of algorithms when available.  The old md5 and sha
modules still exist as wrappers around hashlib to preserve backwards
compatibility.
2005-08-21 18:45:59 +00:00
Georg Brandl 33a5f2af59 Fix BZ2File.(x)readlines() for files without a newline. 2005-08-21 14:16:04 +00:00
Raymond Hettinger a710b331da SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear().  The same code fragment appears in
various guises in list.extend(), map(), filter(), zip(), and internally
in PySequence_Tuple().
2005-08-21 11:03:59 +00:00
Raymond Hettinger c47e01d020 Numerous fix-ups to C API and docs. Added tests for C API. 2005-08-16 10:44:15 +00:00
Barry Warsaw e2eca0b709 Port from the Python 2.4 branch, patches for SF bug # 900092,
hotshot.stats.load.
2005-08-15 18:14:19 +00:00
Raymond Hettinger 038ca2a551 Teach the sets module to correctly compute s-=s and s^=s as the empty set. 2005-08-13 02:29:58 +00:00
Raymond Hettinger 97979ddc14 * Fix SF #1257731. Make __contains__(), remove(), and discard() only do
a frozenset conversion when the initial search attempt fails with a
  TypeError and the key is some type of set.  Add a testcase.

* Eliminate a duplicate if-stmt.
2005-08-12 23:58:22 +00:00
Neil Schemenauer cf52c07843 Change the %s format specifier for str objects so that it returns a
unicode instance if the argument is not an instance of basestring and
calling __str__ on the argument returns a unicode instance.
2005-08-12 17:34:58 +00:00
Raymond Hettinger c991db240c * Add short-circuit code for in-place operations with self (such as
s|=s, s&=s, s-=s, or s^=s).  Add related tests.

* Improve names for several variables and functions.

* Provide alternate table access functions (next, contains, add, and discard)
  that work with an entry argument instead of just a key.  This improves
  set-vs-set operations because we already have a hash value for each key
  and can avoid unnecessary calls to PyObject_Hash().  Provides a 5% to 20%
  speed-up for quick hashing elements like strings and integers.  Provides
  much more substantial improvements for slow hashing elements like tuples
  or objects defining a custom __hash__() function.

* Have difference operations resize() when 1/5 of the elements are dummies.
  Formerly, it was 1/6.  The new ratio triggers less frequently and only
  in cases that it can resize quicker and with greater benefit.  The right
  answer is probably either 1/4, 1/5, or 1/6.  Picked the middle value for
  an even trade-off between resize time and the space/time costs of dummy
  entries.
2005-08-11 07:58:45 +00:00
Tim Peters e9fe7e0ef3 Whitespace normalization (ran reindent.py over the whole tree). 2005-08-07 03:04:58 +00:00