Commit Graph

1226 Commits

Author SHA1 Message Date
Andrew M. Kuchling 78d375fb86 Another typo 2004-08-07 14:00:39 +00:00
Andrew M. Kuchling 28025ecda4 Typo fix 2004-08-07 13:59:22 +00:00
Raymond Hettinger 52a21b8e65 SF patch #980695: efficient string concatenation
(Original patch by Armin Rigo).
2004-08-06 18:43:09 +00:00
Marc-André Lemburg c759f070ef Added new codecs and aliases for ISO_8859-11, ISO_8859-16 and
TIS-620.

Closes SF bug #1001895: Adding missing ISO 8859 codecs, especially Thai.
2004-08-05 12:43:30 +00:00
Anthony Baxter ff347cadc4 release date 2004-08-05 07:21:01 +00:00
Tim Peters 8485b56216 Edward Loper's cool and massive refactoring of doctest.py, merged from
the tim-doctest-merge-24a2 tag on the the tim-doctest-branch branch.
We did development on the branch in case it wouldn't land in time for
2.4a2, but the branch looked good:  Edward's tests passed there, ditto
Python's tests, and ditto the Zope3 tests.  Together, those hit doctest
heavily.
2004-08-04 18:46:34 +00:00
Hye-Shik Chang c81c695dc9 Add a proper pointer to SF bug item. 2004-08-04 17:40:38 +00:00
Hye-Shik Chang 7df44b384a SF #941229: Decode source code with sys.stdin.encoding in interactive
modes like non-interactive modes.  This allows for non-latin-1 users
to write unicode strings directly and sets Japanese users free from
weird manual escaping <wink> in shift_jis environments.
(Reviewed by Martin v. Loewis)
2004-08-04 17:36:41 +00:00
Hye-Shik Chang e9ddfbb412 SF #989185: Drop unicode.iswide() and unicode.width() and add
unicodedata.east_asian_width().  You can still implement your own
simple width() function using it like this:
    def width(u):
        w = 0
        for c in unicodedata.normalize('NFC', u):
            cwidth = unicodedata.east_asian_width(c)
            if cwidth in ('W', 'F'): w += 2
            else: w += 1
        return w
2004-08-04 07:38:35 +00:00
Hye-Shik Chang b5047fd019 Add a workaround for a problem that UTF-8 strings can be corrupted
or broken by basic ctype functions in 4.4BSD descendants.  This
will be fixed in their future development branches but they'll keep
the POSIX-incompatibility for their backward-compatiblities in near
future.
2004-08-04 06:33:51 +00:00
Martin v. Löwis 1fa649f2d5 Patch #986929: Add support for wish -sync and -use options. 2004-08-03 18:45:31 +00:00
Fred Drake f901abdd62 allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
(closes SF bug #658254, patch #663482)
2004-08-03 17:58:55 +00:00
Martin v. Löwis 9513e34ac4 Patch #823072: add option to NOT use ~/.netrc in nntplib.NNTP(). 2004-08-03 14:36:32 +00:00
Martin v. Löwis 65a7975f16 Patch #994595: Recognize Basic auth even if other schemes are offered.
Will backport to 2.3.
2004-08-03 12:59:55 +00:00
Raymond Hettinger 66bd233225 Completed the patch for Bug #215126.
* Fixes an incorrect variable in a PyDict_CheckExact.
* Allow general mapping locals arguments for the execfile() function
  and exec statement.
* Add tests.
2004-08-02 08:30:07 +00:00
Anthony Baxter 32083f64a7 notes for @decorator 2004-08-02 06:24:59 +00:00
Tim Peters 94f9b86930 "Core" and "C API" news about new semantics for failing imports. 2004-08-02 03:48:03 +00:00
Neal Norwitz 0e67fd478f Fix SF #1001053, wave.open() with unicode filename fails
Backport candidate.
2004-08-01 22:48:06 +00:00
Greg Ward 9c8fe1a9b5 Mention upgrade of optparse to Optik 1.5a1. 2004-07-31 16:16:11 +00:00
Tim Peters 5cfb05eef0 Added a new fileno() method. ZODB's repozo.py wants this so it can
apply os.fsync() to the GzipFile backup files it creates.
2004-07-27 21:02:02 +00:00
Martin v. Löwis 544f1195b1 Patch #995766: Keyword argument support in cPickle. 2004-07-27 05:22:33 +00:00
Martin v. Löwis 7b9190b8fc Patch #998149: imaplib deleteacl and myrights. 2004-07-27 05:07:19 +00:00
Martin v. Löwis cc0f93233a Patch #605370: Add description[s] for RFC 2980 compliance. 2004-07-26 12:40:50 +00:00
Tim Peters 66bb6e661c SF bug 996392: math and cmath docs don't specify radians
Major rewrite of the math module docs.  Slapped in "radians" where
appropriate; grouped the functions into reasonable categories; supplied
many more words to address common confusions about some of the subtler
issues.
2004-07-24 23:00:24 +00:00
Marc-André Lemburg b314ce91d3 Add news item for u'%s' change. 2004-07-23 16:14:57 +00:00
Gustavo Niemeyer 7bd33c5e22 This change implements the following gettext features, as
discussed recently in python-dev:

In _locale module:

- bind_textdomain_codeset() binding

In gettext module:

- bind_textdomain_codeset() function
- lgettext(), lngettext(), ldgettext(), ldngettext(),
  which return translated strings encoded in
  preferred system encoding, if
  bind_textdomain_codeset() was not used.
- Added equivalent functionality in translate()
  function and catalog classes.

Every change was also documented.
2004-07-22 18:44:01 +00:00
Tim Peters aa1c7ff7e8 SF patch 995225: tarfile.py fix for bug #990325
Removes CVS keywords from this binary file, so that test_tarfile passes
regardless of whether Python is checked out with -kk.
2004-07-22 00:54:37 +00:00
Brett Cannon 8b3d92a977 Fix bug where a KeyError was raised if -O was being used for the interpreter
and Thread.__delete() was called after a Thread instance was created.  Problem
resulted from a currentThread() call in an 'assert' statement being optimized
out and dummy_thread.get_ident() always returning -1 and thus overwriting the
entry for the _MainThread() instance created in 'threading' at import time.

Closes bug #993394.
2004-07-21 02:21:58 +00:00
Neal Norwitz a4f651a2ae SF #857297 and 916874, improve handling of hard links when extracting 2004-07-20 22:07:44 +00:00
Neal Norwitz 0662f8a5ea SF #846659, fix bufsize violation and GNU longname/longlink extensions 2004-07-20 21:54:18 +00:00
Neil Schemenauer 3a313e3655 Check the type of values returned by __int__, __float__, __long__,
__oct__, and __hex__.  Raise TypeError if an invalid type is
returned.  Note that PyNumber_Int and PyNumber_Long can still
return ints or longs.  Fixes SF bug #966618.
2004-07-19 16:29:17 +00:00
Neil Schemenauer 66edb6295f Don't return spurious empty fields if 'keep_empty_values' is True.
Fixes SF bug #990307.
2004-07-19 15:38:11 +00:00
Tim Peters 90ee7eb18e Record that FCNTL.py has gone away; remove FCNTL hack in tempfile.py;
another hack remains in test___all__.py, but the problem that one
addresses is more general than *just* FCNTL, so leaving it alone.
2004-07-18 23:58:17 +00:00
Hye-Shik Chang 2bb146f2f4 Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
and installed layouts to make maintenance simple and easy.  And it
also adds four new codecs; big5hkscs, euc-jis-2004, shift-jis-2004
and iso2022-jp-2004.
2004-07-18 03:06:29 +00:00
Raymond Hettinger 76d962d700 Treat None as a constant. 2004-07-16 12:16:48 +00:00
Jim Fulton e827437f45 Summarized changes: threading.local, Py_CLEAR, Py_VISIT, improved type
tutorial.
2004-07-14 19:08:28 +00:00
Anthony Baxter fd4984d1fc install test/decimaltestdata as well 2004-07-12 09:33:39 +00:00
Tim Peters 5af0e41482 Bug #788520: Queue class has logic error when non-blocking
I don't agree it had a bug (see the report), so this is *not* a candidate
for backporting, but the docs were confusing and the Queue implementation
was old enough to vote.

Rewrote put/put_nowait/get/get_nowait from scratch, to use a pair of
Conditions (not_full and not_empty), sharing a common mutex.  The code
is 1/4 the size now, and 6.25x easier to understand.  For blocking
with timeout, we also get to reuse (indirectly) the tedious timeout
code from threading.Condition.  The Full and Empty exceptions raised
by non-blocking calls are now easy (instead of nearly impossible) to
explain truthfully:  Full is raised if and only if the Queue truly
is full when the non-blocking put call checks the queue size, and
similarly for Empty versus non-blocking get.

What I don't know is whether the new implementation is slower (or
faster) than the old one.  I don't really care.  Anyone who cares
a lot is encouraged to check that.
2004-07-12 00:45:14 +00:00
Tim Peters 183dabcd73 SF patch 986010: add missing doc for datetime C API, from
Anthony Tuininga.

This is a derived patch, taking the opportunity to add some organization
to the now-large pile of datetime-related macros, and to factor out
tedious repeated text.

Also improved some clumsy wording in NEWS.
2004-07-11 19:26:19 +00:00
Brett Cannon d2c5b4b549 SequenceMatcher(None, [], []).get_grouped_opcodes() now returns a generator
that behaves as if both lists has an empty string in each of them.

Closes bug #979794 (and duplicate bug #980117).
2004-07-10 23:54:07 +00:00
Brett Cannon e6f8a89d1a Debug output is now printed to sys.stderr .
Closes bug #980938.
2004-07-10 23:14:30 +00:00
Brett Cannon f50299c378 posixpath.realpath() now detects symlink loops and returns the path just before
the loop starts.

Closes bug #930024.  Thanks AM Kuchling.
2004-07-10 22:55:15 +00:00
Brett Cannon 711e7d97e4 Add PyArg_VaParseTupleAndKeywords(). Document this function and
PyArg_VaParse().

Closes patch #550732.  Thanks Greg Chapman.
2004-07-10 22:20:32 +00:00
Andrew M. Kuchling 79d7e92a5c Add item 2004-07-10 21:21:55 +00:00
Brett Cannon bdc36273a2 Make ntpath compress multiple slashes between drive letter and the rest of the
path.  Also clarifies UNC handling and adds appropriate tests.

Applies patch #988607 to fix bug #980327.  Thanks Paul Moore.
2004-07-10 20:42:22 +00:00
Brett Cannon e67511809b Add note about closing of bug #679953 and add Jimmy Burgett for helping out to
Misc/ACKS.
2004-07-10 19:13:42 +00:00
Andrew M. Kuchling 64ed298d7a Add an item 2004-07-10 18:43:32 +00:00
Marc-André Lemburg 88fcca6815 Added note about new codecs module APIs. 2004-07-10 16:16:06 +00:00
Raymond Hettinger 21f9fce968 Fix typo. 2004-07-10 16:11:03 +00:00
Raymond Hettinger 5aa478badf Module and tests:
* Map conditions to related signals.
* Make contexts unhashable.
* Eliminate used "default" attribute in exception definitions.
* Eliminate the _filterfunc in favor of a straight list.

Docs:
* Eliminate documented references to conditions that are not signals.
* Eliminate parenthetical notes such as "1/0 --> Inf" which are no
  longer true with the new defaults.
2004-07-09 10:02:53 +00:00
Anthony Baxter 563e449729 post-release fun 2004-07-09 07:30:10 +00:00
Anthony Baxter 3210b36a28 release dates 2004-07-08 05:59:43 +00:00
Guido van Rossum 5124b4a082 Add msg for bug #981530 (shutil.rmtree). Somehow that got missed in
the checkin.
2004-07-06 17:52:32 +00:00
Andrew M. Kuchling 81e3fb4b3a Typo fixes 2004-07-04 15:41:59 +00:00
Brett Cannon 41d13f61d2 Clarify last added comment (bug #754449). 2004-07-03 03:54:54 +00:00
Brett Cannon cc4e935ea5 threading.Thread objects will now print a traceback for an exception raised
during interpreter shutdown instead of masking it with another traceback about
accessing a NoneType when trying to print the exception out in the first place.

Closes bug #754449 (using patch #954922).
2004-07-03 03:52:35 +00:00
Fred Drake 0a4dd390bf Make weak references subclassable:
- weakref.ref and weakref.ReferenceType will become aliases for each
  other

- weakref.ref will be a modern, new-style class with proper __new__
  and __init__ methods

- weakref.WeakValueDictionary will have a lighter memory footprint,
  using a new weakref.ref subclass to associate the key with the
  value, allowing us to have only a single object of overhead for each
  dictionary entry (currently, there are 3 objects of overhead per
  entry: a weakref to the value, a weakref to the dictionary, and a
  function object used as a weakref callback; the weakref to the
  dictionary could be avoided without this change)

- a new macro, PyWeakref_CheckRefExact(), will be added

- PyWeakref_CheckRef() will check for subclasses of weakref.ref

This closes SF patch #983019.
2004-07-02 18:57:45 +00:00
Thomas Heller 04c673b6e2 SF #951851 fixed. 2004-07-02 08:56:20 +00:00
Raymond Hettinger 214b1c3aae SF Bug #215126: Over restricted type checking on eval() function
The builtin eval() function now accepts any mapping for the locals argument.
Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing
down the normal case.  My timings so no measurable impact.
2004-07-02 06:41:07 +00:00
Raymond Hettinger 7c85fa4a52 Move Decimal from the sandbox into production. 2004-07-01 11:01:35 +00:00
Michael W. Hudson 7db865af40 tyop 2004-06-30 09:09:38 +00:00
Michael W. Hudson c30ba849cf restore NEWS entry for 957240 2004-06-30 09:06:29 +00:00
Brett Cannon 46d4ff2b72 Fix stupid mistake of forgetting to mention that the fix for bug #981299
entailed editing the urlparse module.
2004-06-29 04:08:23 +00:00
Brett Cannon fbac294d59 rsync is now a recognized protocol that uses "netloc" (i.e. specifies a network
location) in its addressing.

Closes bug #981299.
2004-06-29 04:02:40 +00:00
Barry Warsaw 11b91a0ea3 Added socket.getservbyport(), and make its second argument and that of
getservbyname() optional.  Update the tests and the docs.
2004-06-28 00:50:43 +00:00
Martin v. Löwis ef82d2fdfe Patch #923098: Share interned strings in marshal. 2004-06-27 16:51:46 +00:00
Brett Cannon f6af76da61 Modules/getpath.c now compiles properly under OS X when using the
--disable-framework build; header file was protected in an #if using the wrong
macro to check.

Closes bug #978645.
2004-06-26 04:03:06 +00:00
Fred Drake ec6229e352 Make distutils "install --home" support all platforms. 2004-06-25 23:02:59 +00:00
Tim Peters 9ddf40b4e1 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
The LaTeX is untested (well, so is the new API, for that matter).
Note that I also changed NULL to get spelled consistently in concrete.tex.
If that was a wrong thing to do, Fred should yell at me.
2004-06-20 22:41:32 +00:00
Tim Peters 1b6f7a9057 Bug 975996: Add _PyTime_DoubleToTimet to C API
New include file timefuncs.h exports private API function
_PyTime_DoubleToTimet() from timemodule.c.  timemodule should export
some other functions too (look for painful bits in datetimemodule.c).

Added insane-argument checking to datetime's assorted fromtimestamp()
and utcfromtimestamp() methods.  Added insane-argument tests of these
to test_datetime, and insane-argument tests for ctime(), localtime()
and gmtime() to test_time.
2004-06-20 02:50:16 +00:00
Brett Cannon 1c3fa18be7 shutil.move() will raise an exception when trying to move a directory into
itself.

Closes bug #919012  .  Thanks Johannes Gijsbers.
2004-06-19 21:11:35 +00:00
Brett Cannon b46ed71d70 Add news item about raising ValueError when timemodule.c code that uses
timestamps will lose precision thanks to time_t < double (bug #919012).
2004-06-19 20:50:47 +00:00
Brett Cannon c6c1f478d9 pydoc.stripid() is now case-insensitive for its regex to support platforms that
have pointer addresses in uppercase.

Closes bug #934282.  Thanks Robin Becker.
2004-06-19 01:02:51 +00:00
Skip Montanaro 56f6a4f225 allow developers to more easily build a profiling version of the interpreter
and modules by configuring with the --enable-profiling flag.
2004-06-18 02:47:22 +00:00
Raymond Hettinger b67ad7e671 Patch #826074: cmath.log optional base argument, fixes #823209
(Contributed by Andrew Gaul.)
2004-06-14 07:40:10 +00:00
Martin v. Löwis ad21945d03 Back out #957240. 2004-06-14 04:58:42 +00:00
Anthony Baxter c982bbde1c Bug 957381: rpmbuild builds a -debuginfo rpm on recent Redhat and Fedora releases.
Ignore it, rather than breaking.

Will backport.

(and r1.1000 for Misc/NEWS!)
2004-06-11 17:16:46 +00:00
Anthony Baxter 3ecdb250af Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.

Bugfix candidate, will backport.
2004-06-11 14:41:18 +00:00
Raymond Hettinger 33ecffb65a SF patch #969791: Add nlargest() and nsmallest() to heapq. 2004-06-10 05:03:17 +00:00
Martin v. Löwis 737ea82a5a Patch #774665: Make Python LC_NUMERIC agnostic. 2004-06-08 18:52:54 +00:00
Martin v. Löwis bdec50f027 Feature request #935915: Add os.path.devnull. 2004-06-08 08:29:33 +00:00
Martin v. Löwis f30d60edbc Patch #510695: Add TSC profiling for the VM. 2004-06-08 08:17:44 +00:00
Tim Peters 604c013ef2 SF 952807: Unpickling pickled instances of subclasses of datetime.date,
datetime.datetime and datetime.time could yield insane objects.  Thanks
to Jiwon Seo for the fix.

Bugfix candidate.  I'll backport it to 2.3.
2004-06-07 23:04:33 +00:00
Thomas Heller 90a764c5ee Fix a refcount bug in an obscure code corner. 2004-06-07 15:12:44 +00:00
Hye-Shik Chang 2400e93057 SF #877165: Give an info about what C++ compiler command should be
used in cygwin and mingw32. (Reported by Michael Droettboom)
2004-06-05 18:37:53 +00:00
Hye-Shik Chang 39aef79821 Fix a bug that robotparser starves memory when the server responses
in HTTP/0.9 due to dissonance of httplib.LineAndFileWrapper and
urllib.addbase.
2004-06-05 13:30:56 +00:00
Brett Cannon 0096e262ff Refactored site.py into functions. Also moved over to using sets.
New regression test suite.
2004-06-05 01:12:51 +00:00
Martin v. Löwis 642c8a11fd Patch #926209: Patch to setup.py to run on x86_64 Linux. 2004-06-04 13:55:13 +00:00
Martin v. Löwis 77ca6c4c84 Warn abou missing mutate flag to ioctl. Fixes #696535. 2004-06-03 12:47:26 +00:00
Hye-Shik Chang bc555e386b Fix the grammar a bit more. (Adjusted by Tony Meyer) 2004-06-03 11:10:58 +00:00
Martin v. Löwis eac324b90b Patch #957240: Add count parameter to asyncore.loop. 2004-06-03 09:18:35 +00:00
Martin v. Löwis 3e501dcfc7 One more attempt to fix the grammar. 2004-06-03 04:03:30 +00:00
Hye-Shik Chang 5629d0e616 Fix grammar hopefully. :) 2004-06-02 16:52:49 +00:00
Hye-Shik Chang 974ed7cfa5 - SF #962502: Add two more methods for unicode type; width() and
iswide() for east asian width manipulation. (Inspired by David
Goodger, Reviewed by Martin v. Loewis)
- Move _PyUnicode_TypeRecord.flags to the end of the struct so that
no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis)
2004-06-02 16:49:17 +00:00
Martin v. Löwis d8948725d2 Patch #954115: Fix os.stat handling of UNC roots.
Will backport to 2.3.
2004-06-02 09:57:56 +00:00
Martin v. Löwis e440e47e91 Patch #957398: Add public API for Generator Object/Type. 2004-06-01 15:22:42 +00:00
Raymond Hettinger 41bd02256f SF bug #942952: Weakness in tuple hash
(Basic approach and test concept by Tim Peters.)

* Improved the hash to reduce collisions.
* Added the torture test to the test suite.
2004-06-01 06:36:24 +00:00
Tim Peters 2f50e90818 SF patch 959726: sdist versus SVN
The disutils sdist command now ignores .svn directories.
2004-05-31 19:27:59 +00:00
Martin v. Löwis 2a6ba9097e Patch #963318: Add support for client-side cookie management. 2004-05-31 18:22:40 +00:00
Raymond Hettinger 027bb633b6 Add weakref support to sockets and re pattern objects. 2004-05-31 03:09:25 +00:00
Skip Montanaro 79cddc56b3 stupid, stupid, stupid... raw_input() already supports readline() if the
readline module is loaded.
2004-05-24 14:20:16 +00:00
Skip Montanaro 0dc23101a0 Exposed readline() function from the readline module. 2004-05-23 17:46:50 +00:00
Raymond Hettinger 059e170c1d SF bug #949329: sets.Set() --> set() 2004-05-19 19:56:44 +00:00
Raymond Hettinger 354433a59d SF patch #872326: Generator expression implementation
(Code contributed by Jiwon Seo.)

The documentation portion of the patch is being re-worked and will be
checked-in soon.  Likewise, PEP 289 will be updated to reflect Guido's
rationale for the design decisions on binding behavior (as described in
in his patch comments and in discussions on python-dev).

The test file, test_genexps.py, is written in doctest format and is
meant to exercise all aspects of the the patch.  Further additions are
welcome from everyone.  Please stress test this new feature as much as
possible before the alpha release.
2004-05-19 08:20:33 +00:00
Thomas Heller 2e7c8328ae Fix SF item #876278: Unbounded recursion in modulefinder.
Already backported to release23-maint.
2004-05-11 15:10:59 +00:00
Martin v. Löwis 456ab1d271 Swap public and system ID in start_doctype_decl. Fixes #780300. 2004-05-06 01:54:36 +00:00
Raymond Hettinger 0468e416c1 SF patch #947476: Apply freelist technique to lists
Re-use list object bodies.  Saves calls to malloc() and free() for
faster list instantiation and deallocation.
2004-05-05 05:37:53 +00:00
Thomas Heller cc10a85fdc Forgot to mention the SF number, and that Bob Ippolito provided the patch. 2004-04-22 17:28:25 +00:00
Thomas Heller 1328b52c6f Two new public API functions, Py_IncRef and Py_DecRef. Useful for
dynamic embedders of Python.
2004-04-22 17:23:49 +00:00
Hye-Shik Chang 0f5bf1ebdd SF #926075: Fixed the bug that returns a wrong pattern object for
a string or unicode object in sre.compile() when a different type
pattern with the same value exists.
2004-04-20 21:11:11 +00:00
Hye-Shik Chang 54f9439b7c Bug #934635: Fix a bug where the configure script couldn't detect
getaddrinfo() properly if the KAME stack had SCTP support.
(Submitted by SUZUKI Shinsuke)
2004-04-14 07:55:31 +00:00
Skip Montanaro d0c0c41fe9 note --trackcalls flag in trace module 2004-04-07 16:03:02 +00:00
Raymond Hettinger e2eda606a8 Improve accuracy of sequence and mapping checks. 2004-04-04 08:51:41 +00:00
Andrew MacIntyre 4e10ed3b86 If a file is opened with an explicit buffer size >= 1, repeated
close() calls would attempt to free() the buffer already free()ed on
the first close().     [bug introduced with patch #788249]

Making sure that the buffer is free()ed in file object deallocation is
a belt-n-braces bit of insurance against a memory leak.
2004-04-04 07:01:35 +00:00
Brett Cannon 21beb4c2ce Fixed a caching bug in platform.platform() where the argument of 'terse' was
not taken into consideration when caching value.
2004-03-25 16:55:12 +00:00
Nicholas Bastin c69ebe8d50 Enable the profiling of C functions (builtins and extensions) 2004-03-24 21:57:10 +00:00
Brett Cannon 06c34798df Make socket.sslerror a subclass of socket.error .
Added socket.error to the socket module's C API.
2004-03-23 23:16:54 +00:00
Nicholas Bastin 824b1b2da8 Added command line options for profile.py - one for stats output file
and one for sort order when using stdout.  Uses optparse.
2004-03-23 18:44:39 +00:00
Nicholas Bastin 1eb4bfc657 Added global runctx function to profile to fix SF Bug #716587 2004-03-22 20:12:56 +00:00
Nicholas Bastin abce8a681c Changed file.name to be the object passed as the 'name' argument to file()
Fixes SF Bug #773356
2004-03-21 20:24:07 +00:00
Hye-Shik Chang c3a87b8dbb Bug #920575: Add a workaround for GNU libc nl_langinfo()'s returning NULL.
(Reported by Matthias Klose)
2004-03-21 19:34:30 +00:00
Nicholas Bastin a7604bf1b4 Moved tracebackobject to traceback.h, Closes SF Bug #497067 2004-03-21 18:37:23 +00:00
Just van Rossum 7139afd1f5 [693255] also back out corresponding NEWS item... 2004-03-21 16:26:32 +00:00
Martin v. Löwis 347c30d217 Patch #853488: Tix hlist missing entryconfigure and entrycget methods. 2004-03-21 15:29:41 +00:00
Raymond Hettinger ff5bc50bb0 Improve byte coding for multiple assignments.
Gives 30% speedup on "a,b=1,2" and 25% on "a,b,c=1,2,3".
2004-03-21 15:12:00 +00:00
Brett Cannon 4f65331483 Limit the nesting depth of a tuple passed as the second argument to
isinstance() or issubclass() to the recursion limit of the interpreter.
2004-03-20 22:52:14 +00:00
Brett Cannon cc45466b8f Remove non-existent paths. 2004-03-20 21:31:33 +00:00
Hye-Shik Chang 4a7ad1a27d Add an entry for addition of the ptcp154 codec. 2004-03-19 08:11:56 +00:00
Raymond Hettinger ade08ea8a8 Add news entries for the dictionary optimizations. 2004-03-18 09:48:12 +00:00
Raymond Hettinger 49f9bd15ff SF feature request #686323: Minor array module enhancements
array.extend() now accepts iterable arguments implements as a series
of appends.  Besides being a user convenience and matching the behavior
for lists, this the saves memory and cycles that would be used to
create a temporary array object.
2004-03-14 05:43:59 +00:00
Raymond Hettinger 6e2ee866fa Update the array overallocation scheme to match the approach used for
lists.  Speeds append() operations and reduces memory requirements
(because of more conservative overallocation).

Paves the way for the feature request for array.extend() to support
arbitrary iterable arguments.
2004-03-14 04:37:50 +00:00
Raymond Hettinger 3aa82c07f7 SF bug #910986: copy.copy fails for array.array
Added support for the copy module.
2004-03-13 18:18:51 +00:00
Raymond Hettinger c1e4f9dd92 Use a new macro, PySequence_Fast_ITEMS to factor out code common to
three recent optimizations.  Aside from reducing code volume, it
increases readability.
2004-03-12 08:04:00 +00:00
Neil Schemenauer 4252a7a5d1 Make buffer objects based on mutable objects (like array) safe. 2004-03-11 02:42:45 +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 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
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
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
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
Michael W. Hudson d3b33b5f6f "Fix" (for certain configurations of the planets, including
recent gcc on Linux/x86)

[ 899109 ] 1==float('nan')

by implementing rich comparisons for floats.

Seems to make comparisons involving NaNs somewhat less surprising
when the underlying C compiler actually implements C99 semantics.
2004-02-19 19:35:22 +00:00
Martin v. Löwis a79449e7a2 Patch #711838: Allow non-anonymous ftp urls in urllib2.
Backported to 2.3.
2004-02-15 21:19:18 +00:00
Raymond Hettinger fa7b9d8255 * Moved the responsibility for emptying the previous list from list_fill
to list_init.

* Replaced the code in list_extend with the superior code from list_fill.

* Eliminated list_fill.

Results:

* list.extend() no longer creates an intermediate tuple except to handle
  the special case of x.extend(x).  The saves memory and time.

* list.extend(x) runs
    about the same x is a list or tuple,
    a little faster when x is an iterable not defining __len__, and
    twice as fast when x is an iterable defining __len__.

* the code is about 15 lines shorter and no longer duplicates
  functionality.
2004-02-15 04:06:39 +00:00
Raymond Hettinger ab517d2eac Fine tune the speed/space trade-off for overallocating small lists.
The Py2.3 approach overallocated small lists by up to 8 elements.
The last checkin would limited this to one but slowed down (by 20 to 30%)
the creation of small lists between 3 to 8 elements.

This tune-up balances the two, limiting overallocation to 3 elements
(significantly reducing space consumption from Py2.3) and running faster
than the previous checkin.

The first part of the growth pattern (0, 4, 8, 16) neatly meshes with
allocators that trigger data movement only when crossing a power of two
boundary.  Also, then even numbers mesh well with common data alignments.
2004-02-14 18:34:46 +00:00
Gustavo Niemeyer a6e436e4b4 - Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
as parameter.
2004-02-14 00:02:45 +00:00
Raymond Hettinger 4bb9540dd6 * Optimized list appends and pops by making fewer calls the underlying system
realloc().  This is achieved by tracking the overallocation size in a new
  field and using that information to skip calls to realloc() whenever
  possible.

* Simplified and tightened the amount of overallocation.  For larger lists,
  this overallocates by 1/8th (compared to the previous scheme which ranged
  between 1/4th to 1/32nd over-allocation).  For smaller lists (n<6), the
  maximum overallocation is one byte (formerly it could be upto eight bytes).
  This saves memory in applications with large numbers of small lists.

* Eliminated the NRESIZE macro in favor of a new, static list_resize function
  that encapsulates the resizing logic.  Coverting this back to macro would
  give a small (under 1%) speed-up.  This was too small to warrant the loss
  of readability, maintainability, and de-coupling.

* Some functions using NRESIZE had grown unnecessarily complex in their
  efforts to bend to the macro's calling pattern.  With the new list_resize
  function in place, those other functions could be simplified.  That is
  being saved for a separate patch.

* The ob_item==NULL check could be eliminated from the new list_resize
  function.  This would entail finding each piece of code that sets ob_item
  to NULL and adding a new line to invalidate the overallocation tracking
  field.  Rather than impose a new requirement on other pieces of list code,
  it was preferred to leave the NULL check in place and retain the benefits
  of decoupling, maintainability and information hiding (only PyList_New()
  and list_sort() need to know about the new field).  This approach also
  reduces the odds of breaking an extension module.

(Collaborative effort by Raymond Hettinger, Hye-Shik Chang, Tim Peters,
 and Armin Rigo.)
2004-02-13 11:36:39 +00:00
Michael W. Hudson ecfeb7f095 This is my patch #876198 plus a NEWS entry and a header frob.
Remove the ability to use (from C) arbitrary objects supporting the
read buffer interface as the co_code member of code objects.
2004-02-12 15:28:27 +00:00
Skip Montanaro 7befb9966e remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
Jim Fulton 8a1a594590 Fixed a bug in object.__reduce_ex__ (reduce_2) when using protocol
2.  Failure to clear the error when attempts to get the __getstate__
  attribute fail caused intermittent errors and odd behavior.
2004-02-08 04:21:26 +00:00
Skip Montanaro db6080507d Remove support for --without-universal-newlines (see PEP 11). 2004-02-07 13:53:46 +00:00
Fred Drake 228765b0e1 added notes about weakref changes 2004-02-06 04:15:22 +00:00
Hye-Shik Chang ff83c2bacc Fix input() builtin function to respect compiler flags.
(SF patch 876178, patch by mwh, unittest by perky)
2004-02-02 13:39:01 +00:00
Martin v. Löwis 12af0485f8 Patch #874083: Bluetooth support for socket module. 2004-01-31 12:34:17 +00:00
Raymond Hettinger 756b3f3c15 * Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
2004-01-29 06:37:52 +00:00
Skip Montanaro d5a21fd387 add hotshotmain ref 2004-01-27 14:49:04 +00:00
Marc-André Lemburg 57cb68fe93 Add news item about change in encodings search function. 2004-01-20 18:24:34 +00:00
Hye-Shik Chang 84a9931b19 Add a news entry for importing of CJK codecs. 2004-01-17 14:59:36 +00:00
Skip Montanaro cd1f7430cb document PEP 11 progress so far. 2004-01-17 14:22:44 +00:00
Raymond Hettinger 0c4102760c SF Patch #864863: Bisect C implementation
(Contributed by Dmitry Vasiliev.)
2004-01-05 10:13:35 +00:00
Barry Warsaw 30ff12ffc2 Add note about new base64.py module support for RFC 3548. 2004-01-04 01:13:43 +00:00
Andrew MacIntyre f1ca7f561c complete backout of listobject.c v2.171 2003-12-28 07:43:56 +00:00
Andrew MacIntyre d57caed52c Performance of list([]) in 2.3 came up in a thread on comp.lang.python,
which can be reviewed via
http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-12/1011.html

Duncan Booth investigated, and discovered that an "optimisation" was
in fact a pessimisation for small numbers of elements in a source list,
compared to not having the optimisation, although with large numbers
of elements in the source list the optimisation was quite beneficial.

He posted his change to comp.lang.python (but not to SF).

Further research has confirmed his assessment that the optimisation only
becomes a net win when the source list has more than 100 elements.

I also found that the optimisation could apply to tuples as well,
but the gains only arrive with source tuples larger than about 320
elements and are nowhere near as significant as the gains with lists,
(~95% gain @ 10000 elements for lists, ~20% gain @ 10000 elements for
tuples) so I haven't proceeded with this.

The code as it was applied the optimisation to list subclasses as
well, and this also appears to be a net loss for all reasonable sized
sources (~80-100% for up to 100 elements, ~20% for more than 500
elements; I tested up to 10000 elements).

Duncan also suggested special casing empty lists, which I've extended
to all empty sequences.

On the basis that list_fill() is only ever called with a list for the
result argument, testing for the source being the destination has
now happens before testing source types.
2003-12-25 13:28:48 +00:00
Raymond Hettinger 64958a15d7 Guido grants a Christmas wish:
sorted() becomes a regular function instead of a classmethod.
2003-12-17 20:43:33 +00:00
Raymond Hettinger c0d49d82de Fix typo and improve wording a bit. 2003-12-15 19:24:34 +00:00
Hye-Shik Chang 060ebedc40 Add an entry for addition of {str,unicode}.rsplit. 2003-12-15 18:51:19 +00:00
Jeremy Hylton 37c5f2a74f Add news item about processor support in urllib2. 2003-12-14 05:29:45 +00:00
Raymond Hettinger 8f5cdaa784 * Added a new method flag, METH_COEXIST.
* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().
2003-12-13 11:26:12 +00:00
Raymond Hettinger d25c1c6351 Implement itertools.groupby()
Original idea by Guido van Rossum.
Idea for skipable inner iterators by Raymond Hettinger.
Idea for argument order and identity function default by Alex Martelli.
Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger).
2003-12-06 16:23:06 +00:00
Thomas Heller c7501d52ef distutils compilers now compile source files in the same order as they
are passed to the compiler.
2003-12-05 20:28:07 +00:00
Fred Drake 713ade69c5 Add news about removal of the PendingDeprecationWarning from apply(). 2003-12-05 17:43:47 +00:00
Walter Dörwald c8de4585a6 Add parameters indent, width and depth to pprint.pprint() and pprint.pformat()
and pass them along to the PrettyPrinter constructor.
2003-12-03 20:26:05 +00:00
Walter Dörwald 7a7ede54d4 Patch #750542: pprint now will pretty print subclasses of list, tuple
and dict too, as long as they don't overwrite __repr__().
2003-12-03 20:15:28 +00:00
Tim Peters 1d7323e4e7 Py_Finalize(): disabled the second call of cyclic gc, and added extensive
comments about why both calls to cyclic gc here can cause problems.

I'll backport to 2.3 maint.  Since the calls were introduced in 2.3,
that will be the end of it.
2003-12-01 21:35:27 +00:00
Raymond Hettinger 166958b5df As discussed on python-dev, added two extractor functions to the
operator module.
2003-12-01 13:18:39 +00:00
Guido van Rossum fd25acacaf Add news item for _winreg fix (SF bug 851056). 2003-11-30 22:10:15 +00:00
Guido van Rossum 6c9e130524 - Removed FutureWarnings related to hex/oct literals and conversions
and left shifts.  (Thanks to Kalle Svensson for SF patch 849227.)
  This addresses most of the remaining semantic changes promised by
  PEP 237, except for repr() of a long, which still shows the trailing
  'L'.  The PEP appears to promise warnings for operations that
  changed semantics compared to Python 2.3, but this is not
  implemented; we've suffered through enough warnings related to
  hex/oct literals and I think it's best to be silent now.
2003-11-29 23:52:13 +00:00
Thomas Heller b310591169 See SF #848614: distutils' msvccompiler now tries to detect that MSVC6
is installed but the registry settings are incomplete because the gui
has never been run.

Already backported to release23-maint.
2003-11-28 19:42:56 +00:00
Martin v. Löwis 94681fc4a3 Patch #849595: Add socket.shutdown() constants. 2003-11-27 19:40:22 +00:00
Raymond Hettinger 4f8f976576 Add optional fillchar argument to ljust(), rjust(), and center() string methods. 2003-11-26 08:21:35 +00:00
Raymond Hettinger bc0f2ab9bb Expose dict_contains() and PyDict_Contains() with is about 10% faster
than PySequence_Contains() and more clearly applicable to dicts.

Apply the new function in setobject.c where __contains__ checking is
ubiquitous.
2003-11-25 21:12:14 +00:00
Guido van Rossum baf0f8f24d - When method objects have an attribute that can be satisfied either
by the function object or by the method object, the function
  object's attribute usually wins.  Christian Tismer pointed out that
  that this is really a mistake, because this only happens for special
  methods (like __reduce__) where the method object's version is
  really more appropriate than the function's attribute.  So from now
  on, all method attributes will have precedence over function
  attributes with the same name.
2003-11-22 23:55:50 +00:00
Tim Peters 403a203223 SF bug 839548: Bug in type's GC handling causes segfaults.
Also SF patch 843455.

This is a critical bugfix.
I'll backport to 2.3 maint, but not beyond that.  The bugs this fixes
have been there since weakrefs were introduced.
2003-11-20 21:21:46 +00:00
Martin v. Löwis af7dc8d8b8 Patch #831747: Add skip_accept_encoding parameter to putrequest. 2003-11-19 19:51:55 +00:00
Raymond Hettinger 70b9f499a3 Remove deprecation of sets.Set.update(). 2003-11-19 15:52:14 +00:00
Martin v. Löwis 6caea370ac Patch #794400: Let PYTHONSTARTUP influence the compiler flags. 2003-11-18 19:46:25 +00:00
Raymond Hettinger a690a9967e * Migrate set() and frozenset() from the sandbox.
* Install the unittests, docs, newsitem, include file, and makefile update.
* Exercise the new functions whereever sets.py was being used.

Includes the docs for libfuncs.tex.  Separate docs for the types are
forthcoming.
2003-11-16 16:17:49 +00:00
Thomas Heller cf0005baf4 Mention patch #841977: modulefinder didn't find extension modules in packages
Backported to release-maint23
2003-11-14 10:33:20 +00:00
Tim Peters add09b4149 SF bug 840829: weakref callbacks and gc corrupt memory.
subtype_dealloc():  This left the dying object exposed to gc, so that
if cyclic gc triggered during the weakref callback, gc tried to delete
the dying object a second time.  That's a disaster.  subtype_dealloc()
had a (I hope!) unique problem here, as every normal dealloc routine
untracks the object (from gc) before fiddling with weakrefs etc.  But
subtype_dealloc has obscure technical reasons for re-registering the
dying object with gc (already explained in a large comment block at
the bottom of the function).

The fix amounts to simply refraining from reregistering the dying object
with gc until after the weakref callback (if any) has been called.

This is a critical bug (hard to predict, and causes seemingly random
memory corruption when it occurs).  I'll backport it to 2.3 later.
2003-11-12 20:43:28 +00:00
Martin v. Löwis d8921379e9 Patch #798297: Add IMAP THREAD command. 2003-11-10 06:44:44 +00:00
Guido van Rossum 967b063add Plug tempfile.mktemp() hole (Iustin Pop). 2003-11-10 02:27:19 +00:00
Raymond Hettinger b3af1813eb Convert heapq.py to a C implementation. 2003-11-08 10:24:38 +00:00
Raymond Hettinger 85c20a41df Implement and apply PEP 322, reverse iteration 2003-11-06 14:06:48 +00:00
Neil Schemenauer f607fc5395 Add traceback.format_exc(). 2003-11-05 23:03:00 +00:00
Anthony Baxter 92bee36045 missing news entry 2003-11-04 14:35:49 +00:00
Martin v. Löwis 45394c281d Patch #531629: Add multicall support. 2003-10-31 13:49:36 +00:00
Martin v. Löwis 48440b7c27 Patch #: Add POP3 over SSL support. 2003-10-31 12:52:35 +00:00
Raymond Hettinger 0a9b9da0c3 Add list.sorted() classmethod. 2003-10-29 06:54:43 +00:00
Skip Montanaro 030f68a66a note db2pickle/pickle2db tweaks 2003-10-28 16:24:00 +00:00
Armin Rigo 2b3eb4062c Deleting cyclic object comparison.
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Alex Martelli a253e183b8 regressing the performance bugfix -- Guido wants the performance bug left
alone, because there can be no guarantee re the semantics of += vs + .
2003-10-25 23:24:14 +00:00
Alex Martelli dd6664514f document the performance fix to builtin_sum(). 2003-10-25 13:02:57 +00:00