Commit Graph

29584 Commits

Author SHA1 Message Date
Neil Schemenauer 6cbba50a43 Make test_coercion.py less sensitive to platform fp quirks. Closes
SF bug #678265.
2004-03-10 17:30:03 +00:00
Raymond Hettinger 66d31f8f38 Use memcpy() instead of memmove() when the buffers are known to be distinct. 2004-03-10 11:44:04 +00:00
Raymond Hettinger ef9bf4031a Tidied up the implementations of reversed (including the custom ones
for xrange and list objects).

* list.__reversed__ now checks the length of the sequence object before
  calling PyList_GET_ITEM() because the mutable could have changed length.

* all three implementations are now tranparent with respect to length and
  maintain the invariant len(it) == len(list(it)) even when the underlying
  sequence mutates.

* __builtin__.reversed() now frees the underlying sequence as soon
  as the iterator is exhausted.

* the code paths were rearranged so that the most common paths
  do not require a jump.
2004-03-10 10:10:42 +00:00
Raymond Hettinger d2c36261a2 Eliminate the double reverse option. It's only use case
was academic and it was potentially confusing to use.
2004-03-10 08:32:47 +00:00
Raymond Hettinger a6366fe085 Optimize inner loops for subscript, repeat, and concat. 2004-03-09 13:05:22 +00:00
Raymond Hettinger f889e10c19 Optimize slice assignments.
* Replace sprintf message with a constant message string -- this error
  message ran on every invocation except straight deletions but it was
  only needed when the rhs was not iterable.  The message was also
  out-of-date and did not reflect that iterable arguments were allowed.

* For inner loops that do not make ref count adjustments, use memmove()
  for fast copying and better readability.

* For inner loops that do make ref count adjustments, speed them up by
  factoring out the constant structure reference and using vitem[] instead.
2004-03-09 08:04:33 +00:00
Hye-Shik Chang 9168c70438 SF Patch #912462: Relocate \end tag to the right place.
(Submitted by George Yoshida)
2004-03-09 05:53:15 +00:00
Raymond Hettinger f114a3ae63 Refactor and optimize code for UNPACK_SEQUENCE.
* Defer error handling for wrong number of arguments to the
  unpack_iterable() function.  Cuts the code size almost in half.

* Replace function calls to PyList_Size() and PyTuple_Size() with
  their smaller and faster macro counterparts.

* Move the constant structure references outside of the inner loops.
2004-03-08 23:25:30 +00:00
Brett Cannon 4b6b7f1515 Remove calls to currentThread() in _Condition methods that were side-effect.
Side-effects were deemed unnecessary and were causing problems at shutdown
time when threads were catching exceptions at start time and then triggering
exceptions trying to call currentThread() after gc'ed.  Masked the initial
exception which was deemed bad.

Fixes bug #754449 .
2004-03-08 22:18:57 +00:00
Raymond Hettinger 3fd500b4a5 The copy module now handles sets directly. The __copy__ methods are no
longer needed.
2004-03-08 18:31:10 +00:00
Raymond Hettinger 3e47f65e28 SF patch #907403: Improvements to cStringIO.writelines()
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes the
method suitable for use with generator expressions.
2004-03-08 18:22:35 +00:00
Raymond Hettinger 6ec099658a SF patch #907403: Improvements to cStringIO.writelines()
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes
the method suitable for use with generator expressions.
2004-03-08 18:17:31 +00:00
Kurt B. Kaiser 73360a3e61 Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
M ClassBrowser.py
M ColorDelegator.py
M EditorWindow.py
M NEWS.txt
M PyShell.py
M TreeWidget.py
M config-highlight.def
M configDialog.py
M configHandler.py
2004-03-08 18:15:31 +00:00
Vinay Sajip 4102478f46 Removed spurious import statement 2004-03-08 16:57:19 +00:00
Raymond Hettinger b7d05db0be Optimize tuple_slice() and make further improvements to list_slice()
and list.extend().  Factoring the inner loops to remove the constant
structure references and fixed offsets gives speedups ranging from
20% to 30%.
2004-03-08 07:25:05 +00:00
Raymond Hettinger f0e3569a28 Refactor the copy dispatcher code in copy.py. Simplifies and shortens
the code by grouping common cases together.
2004-03-08 05:59:33 +00:00
Raymond Hettinger 99842b6534 Small optimizations for list_slice() and list_extend_internal().
* Using addition instead of substraction on array indices allows the
  compiler to use a fast addressing mode.  Saves about 10%.

* Using PyTuple_GET_ITEM and PyList_SET_ITEM is about 7% faster than
  PySequenceFast_GET_ITEM which has to make a list check on every pass.
2004-03-08 05:56:15 +00:00
Raymond Hettinger ebedb2f773 Factor out code common to PyDict_Copy() and PyDict_Merge(). 2004-03-08 04:19:01 +00:00
Brett Cannon 8172ac3d15 Deal with possible case of having time.tzname[1] containing UTC or GMT.
Since it is known ahead of time that UTC and GMT always have no DST adjustment
then just set the isdst value to 0 even if tzname[0] == tzname[1] .
Fixes bug #897817 .
2004-03-07 23:16:27 +00:00
Raymond Hettinger dd80f76265 SF patch #910929: Optimize list comprehensions
Add a new opcode, LIST_APPEND, and apply it to the code generation for
list comprehensions.  Reduces the per-loop overhead by about a third.
2004-03-07 07:31:06 +00:00
Skip Montanaro bff63f0343 update version at top of file 2004-03-05 14:33:21 +00:00
Raymond Hettinger 31017aed36 SF #904720: dict.update should take a 2-tuple sequence like dict.__init_
(Championed by Bob Ippolito.)

The update() method for mappings now accepts all the same argument forms
as the dict() constructor.  This includes item lists and/or keyword
arguments.
2004-03-04 08:25:44 +00:00
Raymond Hettinger 6c79a518e7 Special case endpoint access for speed. 2004-03-04 08:00:54 +00:00
Hye-Shik Chang 30e97dbe96 SF Patch #902444: Use process scope thread on FreeBSD. System scope
is too expensive on FreeBSD's KSE threading infrastructure and
even test_threadedimport fails on default setting.
2004-03-04 06:35:57 +00:00
Skip Montanaro e2b61e0190 * explain flags in doc strings
* reverse order of files on the command line in pickle2db.py to make it
  symmetrical with db2pickle.py in the two-arg case (src, then dest)
2004-03-03 17:42:08 +00:00
Sjoerd Mullender 47db16580a Fixed invalid syntax. 2004-03-03 16:34:31 +00:00
Skip Montanaro 6babcc2ad4 typo 2004-03-03 08:42:23 +00:00
Raymond Hettinger 35c62e58c5 Added license notices that are required to be included in the
documentation as well as the source code.
2004-03-03 08:27:25 +00:00
Brett Cannon d1080a3418 Have strftime() check its time tuple argument to make sure the tuple's values
are within proper boundaries as specified in the docs.

This can break possible code (datetime module needed changing, for instance)
that uses 0 for values that need to be greater 1 or greater (month, day, and
day of year).

Fixes bug #897625.
2004-03-02 04:38:10 +00:00
Raymond Hettinger 0a4977c2f3 Replace left(), right(), and __reversed__() with the more general purpose
__getitem__() and __setitem__().

Simplifies the API, reduces the code size, adds flexibility, and makes
deques work with bisect.bisect(), random.shuffle(), and random.sample().
2004-03-01 23:16:22 +00:00
Skip Montanaro 786ea6bc23 Add pystack definition to Misc/gdbinit with some explanation of its behavior
and add flag comments to ceval.c and main.c alerting people to the coupling
between pystack and the layout of those files.
2004-03-01 15:44:05 +00:00
Neal Norwitz 87f10137bf Make deque_type static so namespace is not polluted. 2004-02-29 15:40:53 +00:00
Neal Norwitz 9a8d55e4a1 Cleanup: remove test file after it is used. 2004-02-29 15:37:50 +00:00
Raymond Hettinger 738ec90ca1 Improvements to collections.deque():
* Add doctests for the examples in the library reference.
* Add two methods, left() and right(), modeled after deques in C++ STL.
* Apply the new method to asynchat.py.
* Add comparison operators to make deques more substitutable for lists.
* Replace the LookupErrors with IndexErrors to more closely match lists.
2004-02-29 02:15:56 +00:00
Jack Jansen fe99927630 - Allow easy opening of experimental database, if pimp >= 0.4
- Allow easy access to the PackMan homepage, for even more databases.
2004-02-28 23:19:42 +00:00
Jack Jansen 192bd966ad getDefaultDatabase() should be a toplevel function, not a method of the
preferences object.
2004-02-28 23:18:43 +00:00
Jack Jansen afd63b9c40 Started on version 0.4: better scheme for finding correct database:
- Try not only "darwin-7.X.Y" but also "darwin-7.X" and "darwin-7",
  so far we've never had to create anew database for a minor release.
- Distinguish between the various different installs (user-installed
  MacPython, apple-installed MacPython, other).
2004-02-28 22:34:02 +00:00
Vinay Sajip 3f74284e1b Minor documentation changes 2004-02-28 16:07:46 +00:00
Neal Norwitz fb0521f153 Use versionadded for new features 2004-02-28 16:00:23 +00:00
Neal Norwitz a9208f1f99 Get rid of unused variable 2004-02-28 15:56:27 +00:00
Neal Norwitz 3e0877ef88 Add version changed/added to doc 2004-02-28 15:19:33 +00:00
Raymond Hettinger bc72c5ae8b Speed-up the joiner call by avoiding Py_BuildValue(). 2004-02-27 10:30:49 +00:00
Christian Tismer 2460c62152 made cPickle fall back to the copy_reg/reduce protocol,
if a function cannot be stored as global.
This is for compatibility with pickle.py .
2004-02-26 16:21:45 +00:00
Marc-André Lemburg d594849c42 Ignore sizehint argument. Fixes SF #844561. 2004-02-26 15:22:17 +00:00
Michael W. Hudson 6bee23cdc3 Oops, didn't mean to commit the removal of float_compare! 2004-02-26 13:16:03 +00:00
Michael W. Hudson 957f9774b6 Pass a variable that actually exists to PyFPE_END_PROTECT in
float_richcompare.  Reported on c.l.py by Helmut Jarausch.
2004-02-26 12:33:09 +00:00
Gregory P. Smith a7befda8d8 Fixes SF bug # 778421
* Fixed a bug in the compatibility interface set_location() method
   where it would not properly search to the next nearest key when
   used on BTree databases.  [SF bug id 788421]
 * Fixed a bug in the compatibility interface set_location() method
   where it could crash when looking up keys in a hash or recno
   format database due to an incorrect free().
2004-02-26 10:07:14 +00:00
Hye-Shik Chang 904de5b734 Make _spawn_posix be ready for EINTR. waitpid(2) can be interrupted
by SIGCHLD or sth because no signal is masked before. This fixes
an optimized installation problem on FreeBSD libpthread.
2004-02-24 23:54:17 +00:00
Jack Jansen e7e9bf2727 kLsUnknownType and kLSUnknownCreator were ints in stead of OSTypes.
Reported by Bob Ippolito.
2004-02-24 21:49:10 +00:00
Jack Jansen 49be4cc861 Setup file to allow the QuickTime for 2.4 to be compiled
for MacPython 2.3 (and, hopefully, python 2.3 for windows too).
2004-02-24 21:25:31 +00:00