]> granicus.if.org Git - python/log
python
22 years agoSlight reordering of directories searched for BerkDB libs and include files.
Skip Montanaro [Thu, 15 Aug 2002 01:34:38 +0000 (01:34 +0000)]
Slight reordering of directories searched for BerkDB libs and include files.
Push /usr/... further down the list - always check /usr/local/... before
/usr/...

Doubt this will help with http://python.org/sf/589427 or not, but these
changes were prompted by my investigation of that bug report.  I wasn't able
to reproduce that problem though

22 years agoforgot the best part - the new tests...
Skip Montanaro [Thu, 15 Aug 2002 01:28:54 +0000 (01:28 +0000)]
forgot the best part - the new tests...
see patch 586561

22 years agoprovide less mysterious error messages when seeing end-of-line in
Skip Montanaro [Thu, 15 Aug 2002 01:20:16 +0000 (01:20 +0000)]
provide less mysterious error messages when seeing end-of-line in
single-quoted strings or end-of-file in triple-quoted strings.
closes patch 586561.

22 years agoAdd 'in' change
Andrew M. Kuchling [Thu, 15 Aug 2002 00:40:21 +0000 (00:40 +0000)]
Add 'in' change
Revise sentence
Add two reminders

22 years agoAdd news about Fred's change to Py_InitModule4().
Guido van Rossum [Wed, 14 Aug 2002 21:20:32 +0000 (21:20 +0000)]
Add news about Fred's change to Py_InitModule4().

22 years agoReflow long lines.
Jeremy Hylton [Wed, 14 Aug 2002 21:01:41 +0000 (21:01 +0000)]
Reflow long lines.

22 years agoPy_InitModule() and friends now accept NULL for the 'methods'
Fred Drake [Wed, 14 Aug 2002 20:59:38 +0000 (20:59 +0000)]
Py_InitModule() and friends now accept NULL for the 'methods'
argument.  This makes sense now that extension types can support
__init__ directly rather than requiring function constructors.

22 years agoPy_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake [Wed, 14 Aug 2002 20:57:56 +0000 (20:57 +0000)]
Py_InitModule4():  Accept NULL for the 'methods' argument.  This makes
sense now that extension types can support __init__ directly rather
than requiring function constructors.

22 years agoDocstring nits: The module is neither proposed nor new.
Jeremy Hylton [Wed, 14 Aug 2002 19:25:42 +0000 (19:25 +0000)]
Docstring nits: The module is neither proposed nor new.

22 years agoAdded Hisao Suzuki.
Martin v. Löwis [Wed, 14 Aug 2002 18:52:54 +0000 (18:52 +0000)]
Added Hisao Suzuki.

22 years agoMore changes of DeprecationWarning to FutureWarning.
Guido van Rossum [Wed, 14 Aug 2002 18:38:27 +0000 (18:38 +0000)]
More changes of DeprecationWarning to FutureWarning.

22 years agoExplain use of currentThread() in _Condition methods.
Jeremy Hylton [Wed, 14 Aug 2002 17:56:13 +0000 (17:56 +0000)]
Explain use of currentThread() in _Condition methods.

22 years agoThe filterwarnings() call here should be updated to filter out
Guido van Rossum [Wed, 14 Aug 2002 17:54:48 +0000 (17:54 +0000)]
The filterwarnings() call here should be updated to filter out
FutureWarning.

22 years agoExplain a little more.
Jeremy Hylton [Wed, 14 Aug 2002 17:46:40 +0000 (17:46 +0000)]
Explain a little more.

22 years agoExplain a minor mystery.
Jeremy Hylton [Wed, 14 Aug 2002 17:43:59 +0000 (17:43 +0000)]
Explain a minor mystery.

22 years agoPyType_Ready(): initialize the base class a bit earlier, so that if we
Guido van Rossum [Wed, 14 Aug 2002 17:26:30 +0000 (17:26 +0000)]
PyType_Ready(): initialize the base class a bit earlier, so that if we
copy the metatype from the base, the base actually has one!

22 years agok_mul() comments: Simplified the simplified explanation of why ah*bh and
Tim Peters [Wed, 14 Aug 2002 17:07:32 +0000 (17:07 +0000)]
k_mul() comments:  Simplified the simplified explanation of why ah*bh and
al*bl "always fit":  it's actually trivial given what came before.

22 years agoMore updates describing FutureWarnings.
Barry Warsaw [Wed, 14 Aug 2002 16:40:54 +0000 (16:40 +0000)]
More updates describing FutureWarnings.

22 years agomkstemp's last argument changed from binary=True to text=False.
Tim Peters [Wed, 14 Aug 2002 16:37:10 +0000 (16:37 +0000)]
mkstemp's last argument changed from binary=True to text=False.

22 years agok_mul() comments: Explained why there's always enough room to subtract
Tim Peters [Wed, 14 Aug 2002 16:36:23 +0000 (16:36 +0000)]
k_mul() comments:  Explained why there's always enough room to subtract
ah*bh and al*bl.  This is much easier than explaining why that's true
for (ah+al)*(bh+bl), and follows directly from the simple part of the
(ah+al)*(bh+bl) explanation.

22 years agoAdd news about FutureWarning and PEP 237 stage B0.
Guido van Rossum [Wed, 14 Aug 2002 16:11:30 +0000 (16:11 +0000)]
Add news about FutureWarning and PEP 237 stage B0.

Tim predicts that we might as well call this CassandraWarning.

22 years agoDocument PyExc_FutureWarning
Barry Warsaw [Wed, 14 Aug 2002 16:06:28 +0000 (16:06 +0000)]
Document PyExc_FutureWarning

22 years agoAdded a FutureWarning for constructs that will change semantically in
Barry Warsaw [Wed, 14 Aug 2002 15:51:29 +0000 (15:51 +0000)]
Added a FutureWarning for constructs that will change semantically in
the future.  Changed PEP 237 hex constant warnings from
DeprecationWarning to FutureWarning.  Updated the documentation.

22 years agoPatch #550192: Set softspace to 0 in raw_input().
Martin v. Löwis [Wed, 14 Aug 2002 15:46:02 +0000 (15:46 +0000)]
Patch #550192: Set softspace to 0 in raw_input().

22 years agotempfile's mkstemp(): Changed last argument from
Tim Peters [Wed, 14 Aug 2002 15:41:26 +0000 (15:41 +0000)]
tempfile's mkstemp():  Changed last argument from

    binary=True
to
    text=False

by BDFL Pronouncement.  All other changes follow from this.  The change
to the docs is ready to go, but blocked by another JackMacLock in the
doc directory.

22 years agoRemove a broken example of extreme backward compatibility; it is
Fred Drake [Wed, 14 Aug 2002 15:26:18 +0000 (15:26 +0000)]
Remove a broken example of extreme backward compatibility; it is
simply not relevant any more.
Closes SF bug #595032.

22 years agoPatch #595014: Cygwin tempfile patch
Jason Tishler [Wed, 14 Aug 2002 15:10:09 +0000 (15:10 +0000)]
Patch #595014: Cygwin tempfile patch

Although Cygwin attempts to be as Posix compliant
as possible, it has difficulties unlinking open
files. This is not surprising given that Cygwin is
dependent on Win32 which in turn has this problem
itself.

The attached tempfile patch acknowledges this
Cygwin limitation. Without this patch, Cygwin
fails test_tempfile (i.e., test_has_no_name) as
follows:

$ ./python -E -tt ../Lib/test/regrtest.py -l test_tempfile
test_tempfile
test test_tempfile failed -- Traceback (most recent call last):
  File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 689, in test_has_no_name
    self.failOnException("rmdir", ei)
  File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 33, in failOnException
    self.fail("%s raised %s: %s" % (what, ei[0], ei[1]))
  File "/home/jt/src/PythonCvs/Lib/unittest.py", line 260, in fail
    raise self.failureException, msg
AssertionError: rmdir raised exceptions.OSError: [Errno 90] Directory not empty: '/mnt/c/DOCUME~1/jatis/LOCALS~1/Temp/tmpM_z8nj'

22 years agoPatch by Tim to shut up the compiler's DeprecationWarnings on the
Barry Warsaw [Wed, 14 Aug 2002 15:09:12 +0000 (15:09 +0000)]
Patch by Tim to shut up the compiler's DeprecationWarnings on the
high-bit-set hex constants.

22 years agotest_many(): open only 100 temp files, not 1000. Some systems don't
Guido van Rossum [Wed, 14 Aug 2002 14:52:02 +0000 (14:52 +0000)]
test_many(): open only 100 temp files, not 1000.  Some systems don't
allow that many open files per process.  I don't see that 1000 makes
any difference for the test.

22 years agoPatch #588564: _locale library patch
Jason Tishler [Wed, 14 Aug 2002 11:13:52 +0000 (11:13 +0000)]
Patch #588564: _locale library patch

This patch enables setup.py to find gettext routines when they are
located in libintl instead of libc.  Although I developed this patch for
Cygwin, I hope that it can be easily updated to support other platforms
(if necessary). I tested this patch under Cygwin and Red Hat Linux 7.1.

22 years agoCheck for trailing backslash. Fixes #593656.
Martin v. Löwis [Wed, 14 Aug 2002 08:22:50 +0000 (08:22 +0000)]
Check for trailing backslash. Fixes #593656.

22 years agoPatch #505705: Remove eval in pickle and cPickle.
Martin v. Löwis [Wed, 14 Aug 2002 07:46:28 +0000 (07:46 +0000)]
Patch #505705: Remove eval in pickle and cPickle.

22 years agotightening up a few except: clauses
Skip Montanaro [Wed, 14 Aug 2002 02:58:16 +0000 (02:58 +0000)]
tightening up a few except: clauses
see bug 411881

22 years agoFix memory leaks reported by valgrind
Neal Norwitz [Wed, 14 Aug 2002 02:03:50 +0000 (02:03 +0000)]
Fix memory leaks reported by valgrind

22 years agoadd some example docstrings using PyDoc_STR
Skip Montanaro [Wed, 14 Aug 2002 01:45:37 +0000 (01:45 +0000)]
add some example docstrings using PyDoc_STR

22 years agoadd PyDoc_STR and PyDoc_STRVAR calls as examples for module authors
Skip Montanaro [Wed, 14 Aug 2002 01:44:33 +0000 (01:44 +0000)]
add PyDoc_STR and PyDoc_STRVAR calls as examples for module authors

22 years agoruntest(): I don't know why we don't just use TESTFN, but if we have to
Tim Peters [Wed, 14 Aug 2002 01:05:57 +0000 (01:05 +0000)]
runtest():  I don't know why we don't just use TESTFN, but if we have to
do bizarre things to get a temp file, I changed it to use mkstemp instead
of NamedTemporaryFile.  This tried to leave the file open while passing
its name to execfile().  On Win2K (but not Win9X), though, a file created
with O_TEMPORARY cannot be opened again, so the test failed with a
permission error when execfile tried to open it.  Closer to the truth:
a file created with O_TEMPORARY can be opened again, but only if the
file is also created with SHARE_DELETE access via the Win32 CreateFile()
function.  There's no way to get at that from MS's version of libc, though
(we'd have to ditch the "std" C file functions in favor of Win32 API
calls).

22 years agomkstemp(): Repaired error in docstring (the sense of the 'binary' flag
Tim Peters [Wed, 14 Aug 2002 00:49:50 +0000 (00:49 +0000)]
mkstemp():  Repaired error in docstring (the sense of the 'binary' flag
was reversed).

22 years agomkstemp(): The optional "binary" argument is clearly intended to be a
Tim Peters [Tue, 13 Aug 2002 23:38:30 +0000 (23:38 +0000)]
mkstemp():  The optional "binary" argument is clearly intended to be a
Boolean, so changed its default value from 1 to True.

22 years agoNamedTemporaryFile(), TemporaryFile(): removed needless local vrbl 'bin'.
Tim Peters [Tue, 13 Aug 2002 23:36:01 +0000 (23:36 +0000)]
NamedTemporaryFile(), TemporaryFile():  removed needless local vrbl 'bin'.

22 years agotemplate: removed special-casing for NT; there isn't an 8-character limit.
Tim Peters [Tue, 13 Aug 2002 23:33:56 +0000 (23:33 +0000)]
template:  removed special-casing for NT; there isn't an 8-character limit.

22 years ago_once(): Removed obfuscating aliasing of _once_lock.
Tim Peters [Tue, 13 Aug 2002 23:31:02 +0000 (23:31 +0000)]
_once():  Removed obfuscating aliasing of _once_lock.

22 years ago_once(): Simplified dict manipulation.
Tim Peters [Tue, 13 Aug 2002 23:29:21 +0000 (23:29 +0000)]
_once():  Simplified dict manipulation.

22 years agoAllow more docstrings to be removed during compilation in some modules
Neal Norwitz [Tue, 13 Aug 2002 22:20:41 +0000 (22:20 +0000)]
Allow more docstrings to be removed during compilation in some modules

22 years agoAllow more docstrings to be removed during compilation
Neal Norwitz [Tue, 13 Aug 2002 22:19:13 +0000 (22:19 +0000)]
Allow more docstrings to be removed during compilation

22 years agoAdded a test specifically to tickle Karatsuba; it costs no appreciable
Tim Peters [Tue, 13 Aug 2002 21:06:55 +0000 (21:06 +0000)]
Added a test specifically to tickle Karatsuba; it costs no appreciable
runtime.

22 years agoAdd a missing call to _strclass().
Jeremy Hylton [Tue, 13 Aug 2002 20:43:46 +0000 (20:43 +0000)]
Add a missing call to _strclass().

22 years agoFixed error in new comment.
Tim Peters [Tue, 13 Aug 2002 20:42:00 +0000 (20:42 +0000)]
Fixed error in new comment.

22 years agok_mul(): The fix for (ah+al)*(bh+bl) spilling 1 bit beyond the allocated
Tim Peters [Tue, 13 Aug 2002 20:37:51 +0000 (20:37 +0000)]
k_mul():  The fix for (ah+al)*(bh+bl) spilling 1 bit beyond the allocated
space is no longer needed, so removed the code.  It was only possible when
a degenerate (ah->ob_size == 0) split happened, but after that fix went
in I added k_lopsided_mul(), which saves the body of k_mul() from seeing
a degenerate split.  So this removes code, and adds a honking long comment
block explaining why spilling out of bounds isn't possible anymore.  Note:
ff we end up spilling out of bounds anyway <wink>, an assert in v_iadd()
is certain to trigger.

22 years agoRegress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw [Tue, 13 Aug 2002 20:09:26 +0000 (20:09 +0000)]
Regress Guido's change of 2002/08/06 to check for the zlib version
1.1.4.  Redhat hasn't upgraded but does provide a patched 1.1.3
package, so checking for 1.1.4 just makes life difficult.

22 years agoAllow docstrings to be removed during compilation for *SLOT macro and friends
Neal Norwitz [Tue, 13 Aug 2002 19:01:38 +0000 (19:01 +0000)]
Allow docstrings to be removed during compilation for *SLOT macro and friends

22 years agoAdd tests for including __dict__ and/or __weakref__ in __slots__.
Guido van Rossum [Tue, 13 Aug 2002 18:26:26 +0000 (18:26 +0000)]
Add tests for including __dict__ and/or __weakref__ in __slots__.
Add some more rigor to slotmultipleinheritance().

22 years agoSF bug #574235, convert_path fails with empty pathname
Neal Norwitz [Tue, 13 Aug 2002 17:42:57 +0000 (17:42 +0000)]
SF bug #574235, convert_path fails with empty pathname

22 years agoAllow docstrings to be removed during compilation
Neal Norwitz [Tue, 13 Aug 2002 17:18:45 +0000 (17:18 +0000)]
Allow docstrings to be removed during compilation

22 years agoAdd test for SF bug # 575229, multiple inheritance w/ slots dumps core
Neal Norwitz [Tue, 13 Aug 2002 17:16:49 +0000 (17:16 +0000)]
Add test for SF bug # 575229, multiple inheritance w/ slots dumps core
Fix already checked in by Guido

22 years agoRemove ugly irregular spaces from in front of some comments.
Fred Drake [Tue, 13 Aug 2002 13:59:55 +0000 (13:59 +0000)]
Remove ugly irregular spaces from in front of some comments.

22 years agoBug #556025: list(xrange(1e9)) --> seg fault
Jason Tishler [Tue, 13 Aug 2002 11:42:41 +0000 (11:42 +0000)]
Bug #556025: list(xrange(1e9)) --> seg fault

Close the bug report again -- this time for Cygwin due to a newlib bug.
See the following for the details:

http://sources.redhat.com/ml/newlib/2002/msg00369.html

Note that this commit is only a documentation (i.e., comment) change.

22 years agoAdd an improvement wrinkle to Neil Schemenauer's change to int_mul
Guido van Rossum [Tue, 13 Aug 2002 10:05:56 +0000 (10:05 +0000)]
Add an improvement wrinkle to Neil Schemenauer's change to int_mul
(rev. 2.86).  The other type is only disqualified from sq_repeat when
it has the CHECKTYPES flag.  This means that for extension types that
only support "old-style" numeric ops, such as Zope 2's ExtensionClass,
sq_repeat still trumps nb_multiply.

22 years agotest_division(): Added one larger digits value, to ensure that the
Tim Peters [Tue, 13 Aug 2002 02:24:25 +0000 (02:24 +0000)]
test_division():  Added one larger digits value, to ensure that the
"lopsided Karatsuba" driver also gets some exercise.

22 years agoMachines-- and Python --are a lot faster in relevant ways since this
Tim Peters [Tue, 13 Aug 2002 02:17:11 +0000 (02:17 +0000)]
Machines-- and Python --are a lot faster in relevant ways since this
test was written.  So boosted the number of "digits" this generates, and
also beefed up the "* / divmod" test to tickle numbers big enough to
trigger the Karatsuba algorithm.  It takes about 2 seconds now on my box.

22 years agoFix comment for PyLong_AsUnsignedLong() to say that the return value
Guido van Rossum [Tue, 13 Aug 2002 00:24:58 +0000 (00:24 +0000)]
Fix comment for PyLong_AsUnsignedLong() to say that the return value
is an *unsigned* long.

22 years agoFix wanrings about unsigned hex constants.
Guido van Rossum [Mon, 12 Aug 2002 22:11:28 +0000 (22:11 +0000)]
Fix wanrings about unsigned hex constants.

22 years agok_lopsided_mul(): This allocated more space for bslice than necessary.
Tim Peters [Mon, 12 Aug 2002 22:10:00 +0000 (22:10 +0000)]
k_lopsided_mul():  This allocated more space for bslice than necessary.

22 years agoThe auto-reply text for the python-docs address. This is not automatically
Fred Drake [Mon, 12 Aug 2002 22:01:42 +0000 (22:01 +0000)]
The auto-reply text for the python-docs address.  This is not automatically
updated when checkins are made, but I can get that updated when needed.

22 years agoAdded new function k_lopsided_mul(), which is much more efficient than
Tim Peters [Mon, 12 Aug 2002 22:01:34 +0000 (22:01 +0000)]
Added new function k_lopsided_mul(), which is much more efficient than
k_mul() when inputs have vastly different sizes, and a little more
efficient when they're close to a factor of 2 out of whack.

I consider this done now, although I'll set up some more correctness
tests to run overnight.

22 years agoDon't use hex constants representing negative numbers.
Guido van Rossum [Mon, 12 Aug 2002 22:01:24 +0000 (22:01 +0000)]
Don't use hex constants representing negative numbers.

22 years agoSuppress warnings about test_grammar.py that can't be suppressed inside
Guido van Rossum [Mon, 12 Aug 2002 21:55:51 +0000 (21:55 +0000)]
Suppress warnings about test_grammar.py that can't be suppressed inside
that file itself (because it's the parser that reports them).

22 years agoUse PyErr_WarnExplicit() to warn about hex/oct constants, so the
Guido van Rossum [Mon, 12 Aug 2002 21:54:46 +0000 (21:54 +0000)]
Use PyErr_WarnExplicit() to warn about hex/oct constants, so the
correct filename and line number are reported.

22 years agoUpdated for the current state of affairs.
Jack Jansen [Mon, 12 Aug 2002 20:46:18 +0000 (20:46 +0000)]
Updated for the current state of affairs.

22 years agoNew names.
Guido van Rossum [Mon, 12 Aug 2002 20:20:39 +0000 (20:20 +0000)]
New names.

22 years agoMake sure that *any* object whose id() is used as a memo key is kept
Guido van Rossum [Mon, 12 Aug 2002 20:20:08 +0000 (20:20 +0000)]
Make sure that *any* object whose id() is used as a memo key is kept
alive in the memo.  This fixes SF bug 592567.

22 years agok_mul(): Moved an assert down. In a debug build, interrupting a
Tim Peters [Mon, 12 Aug 2002 19:43:49 +0000 (19:43 +0000)]
k_mul():  Moved an assert down.  In a debug build, interrupting a
multiply via Ctrl+C could cause a NULL-pointer dereference due to
the assert.

22 years agok_mul(): Heh -- I checked in two fixes for the last problem. Only keep
Tim Peters [Mon, 12 Aug 2002 19:38:01 +0000 (19:38 +0000)]
k_mul():  Heh -- I checked in two fixes for the last problem.  Only keep
the good one <wink>.  Also checked in a test-aid by mistake.

22 years agok_mul(): White-box testing turned up that (ah+al)*(bh+bl) can, in rare
Tim Peters [Mon, 12 Aug 2002 19:30:26 +0000 (19:30 +0000)]
k_mul():  White-box testing turned up that (ah+al)*(bh+bl) can, in rare
cases, overflow the allocated result object by 1 bit.  In such cases,
it would have been brought back into range if we subtracted al*bl and
ah*bh from it first, but I don't want to do that because it hurts cache
behavior.  Instead we just ignore the excess bit when it appears -- in
effect, this is forcing unsigned mod BASE**(asize + bsize) arithmetic
in a case where that doesn't happen all by itself.

22 years agoFix MSVC warnings.
Guido van Rossum [Mon, 12 Aug 2002 19:25:08 +0000 (19:25 +0000)]
Fix MSVC warnings.

22 years agoRefactor how __dict__ and __weakref__ interact with __slots__.
Guido van Rossum [Mon, 12 Aug 2002 19:05:44 +0000 (19:05 +0000)]
Refactor how __dict__ and __weakref__ interact with __slots__.

1. You can now have __dict__ and/or __weakref__ in your __slots__
   (before only __weakref__ was supported).  This is treated
   differently than before: it merely sets a flag that the object
   should support the corresponding magic.

2. Dynamic types now always have descriptors __dict__ and __weakref__
   thrust upon them.  If the type in fact does not support one or the
   other, that descriptor's __get__ method will raise AttributeError.

3. (This is the reason for all this; it fixes SF bug 575229, reported
   by Cesar Douady.)  Given this code:
      class A(object): __slots__ = []
      class B(object): pass
      class C(A, B): __slots__ = []
   the class object for C was broken; its size was less than that of
   B, and some descriptors on B could cause a segfault.  C now
   correctly inherits __weakrefs__ and __dict__ from B, even though A
   is the "primary" base (C.__base__ is A).

4. Some code cleanup, and a few comments added.

22 years agox_mul(): Made life easier for C optimizers in the "grade school"
Tim Peters [Mon, 12 Aug 2002 18:25:43 +0000 (18:25 +0000)]
x_mul():  Made life easier for C optimizers in the "grade school"
algorithm.  MSVC 6 wasn't impressed <wink>.

Something odd:  the x_mul algorithm appears to get substantially worse
than quadratic time as the inputs grow larger:

bits in each input   x_mul time   k_mul time
------------------   ----------   ----------
             15360         0.01         0.00
             30720         0.04         0.01
             61440         0.16         0.04
            122880         0.64         0.14
            245760         2.56         0.40
            491520        10.76         1.23
            983040        71.28         3.69
           1966080       459.31        11.07

That is, x_mul is perfectly quadratic-time until a little burp at
2.56->10.76, and after that goes to hell in a hurry.  Under Karatsuba,
doubling the input size "should take" 3 times longer instead of 4, and
that remains the case throughout this range.  I conclude that my "be nice
to the cache" reworkings of k_mul() are paying.

22 years agok_mul() and long_mul(): I'm confident that the Karatsuba algorithm is
Tim Peters [Mon, 12 Aug 2002 17:36:03 +0000 (17:36 +0000)]
k_mul() and long_mul():  I'm confident that the Karatsuba algorithm is
correct now, so added some final comments, did some cleanup, and enabled
it for all long-int multiplies.  The KARAT envar no longer matters,
although I left some #if 0'ed code in there for my own use (temporary).
k_mul() is still much slower than x_mul() if the inputs have very
differenent sizes, and that still needs to be addressed.

22 years agoPortable way of producing unsigned 32-bit hex output to print the
Guido van Rossum [Mon, 12 Aug 2002 15:26:05 +0000 (15:26 +0000)]
Portable way of producing unsigned 32-bit hex output to print the
CRCs.

22 years agoShut up warnings about hex()/oct() that can't be avoided.
Guido van Rossum [Mon, 12 Aug 2002 15:16:20 +0000 (15:16 +0000)]
Shut up warnings about hex()/oct() that can't be avoided.

22 years agoAvoid warnings about <<. external_attr is now an unsigned long.
Guido van Rossum [Mon, 12 Aug 2002 15:15:51 +0000 (15:15 +0000)]
Avoid warnings about <<.  external_attr is now an unsigned long.

22 years agok_mul: Rearranged computation for better cache use. Ignored overflow
Tim Peters [Mon, 12 Aug 2002 15:08:20 +0000 (15:08 +0000)]
k_mul:  Rearranged computation for better cache use.  Ignored overflow
(it's possible, but should be harmless -- this requires more thought,
and allocating enough space in advance to prevent it requires exactly
as much thought, to know exactly how much that is -- the end result
certainly fits in the allocated space -- hmm, but that's really all
the thought it needs!  borrows/carries out of the high digits really
are harmless).

22 years agoCorrect PyAPI_FUNC to PyAPI_DATA - sorry Jack.
Mark Hammond [Mon, 12 Aug 2002 13:06:35 +0000 (13:06 +0000)]
Correct PyAPI_FUNC to PyAPI_DATA - sorry Jack.

22 years agoAdd name mangling for new PyUnicode_FromOrdinal() and fix declaration
Marc-André Lemburg [Mon, 12 Aug 2002 08:19:10 +0000 (08:19 +0000)]
Add name mangling for new PyUnicode_FromOrdinal() and fix declaration
to use new extern macro.

22 years agoExcise DL_EXPORT from Include.
Mark Hammond [Mon, 12 Aug 2002 07:21:58 +0000 (07:21 +0000)]
Excise DL_EXPORT from Include.

Thanks to Skip Montanaro and Kalle Svensson for the patches.

22 years agox_mul(): This failed to normalize its result.
Tim Peters [Mon, 12 Aug 2002 06:17:58 +0000 (06:17 +0000)]
x_mul():  This failed to normalize its result.

k_mul():  This didn't allocate enough result space when one input had
more than twice as many bits as the other.  This was partly hidden by
that x_mul() didn't normalize its result.

The Karatsuba recurrence is pretty much hosed if the inputs aren't
roughly the same size.  If one has at least twice as many bits as the
other, we get a degenerate case where the "high half" of the smaller
input is 0.  Added a special case for that, for speed, but despite that
it helped, this can still be much slower than the "grade school" method.
It seems to take a really wild imbalance to trigger that; e.g., a
2**22-bit input times a 1000-bit input on my box runs about twice as slow
under k_mul than under x_mul.  This still needs to be addressed.

I'm also not sure that allocating a->ob_size + b->ob_size digits is
enough, given that this is computing k = (ah+al)*(bh+bl) instead of
k = (ah-al)*(bl-bh); i.e., it's certainly enough for the final result,
but it's vaguely possible that adding in the "artificially" large k may
overflow that temporarily.  If so, an assert will trigger in the debug
build, but we'll probably compute the right result anyway(!).

22 years agoIntroduced helper functions v_iadd and v_isub, for in-place digit-vector
Tim Peters [Mon, 12 Aug 2002 05:09:36 +0000 (05:09 +0000)]
Introduced helper functions v_iadd and v_isub, for in-place digit-vector
addition and subtraction.  Reworked the tail end of k_mul() to use them.
This saves oodles of one-shot longobject allocations (this is a triply-
recursive routine, so saving one allocation in the body saves 3**n
allocations at depth n; we actually save 2 allocations in the body).

22 years agoNew news about __class__ assignment restrictions and speed-up of
Guido van Rossum [Mon, 12 Aug 2002 03:42:03 +0000 (03:42 +0000)]
New news about __class__ assignment restrictions and speed-up of
new-style object creation/deallocation.

Moved all news about type/class unification and new-stype classes to a
separate section at the top.

22 years agoRevert what looks like a typo from the last checkin
Neal Norwitz [Mon, 12 Aug 2002 03:33:32 +0000 (03:33 +0000)]
Revert what looks like a typo from the last checkin

22 years agok_mul(): Repaired another typo in another comment.
Tim Peters [Mon, 12 Aug 2002 02:54:10 +0000 (02:54 +0000)]
k_mul():  Repaired another typo in another comment.

22 years agok_mul(): Repaired typo in comment.
Tim Peters [Mon, 12 Aug 2002 02:43:58 +0000 (02:43 +0000)]
k_mul():  Repaired typo in comment.

22 years agoCautious introduction of a patch that started from
Tim Peters [Mon, 12 Aug 2002 02:31:19 +0000 (02:31 +0000)]
Cautious introduction of a patch that started from
SF 560379:  Karatsuba multiplication.
Lots of things were changed from that.  This needs a lot more testing,
for correctness and speed, the latter especially when bit lengths are
unbalanced.  For now, the Karatsuba code gets invoked if and only if
envar KARAT exists.

22 years agoFixed misspelling in comment.
Tim Peters [Sun, 11 Aug 2002 18:28:09 +0000 (18:28 +0000)]
Fixed misspelling in comment.

22 years agoint_lshift(): Simplified/sped overflow-checking.
Tim Peters [Sun, 11 Aug 2002 17:54:42 +0000 (17:54 +0000)]
int_lshift():  Simplified/sped overflow-checking.

22 years agoExtend stripid() to handle strings ending in more than one '>'.
Ka-Ping Yee [Sun, 11 Aug 2002 15:11:33 +0000 (15:11 +0000)]
Extend stripid() to handle strings ending in more than one '>'.
Add resolve() to handle looking up objects and names (fix SF bug 586931).
Add a nicer error message when given a filename that doesn't exist.

22 years agoReset errno to zero after calling PyErr_Warn(). It can potentially do
Guido van Rossum [Sun, 11 Aug 2002 14:06:15 +0000 (14:06 +0000)]
Reset errno to zero after calling PyErr_Warn().  It can potentially do
a lot of work, including I/O (e.g. to import warnings.py), which might
affect errno.

22 years agoUse a better check for overflow from a<<b.
Guido van Rossum [Sun, 11 Aug 2002 14:04:13 +0000 (14:04 +0000)]
Use a better check for overflow from a<<b.

22 years agoAdd C API PyUnicode_FromOrdinal() which exposes unichr() at C level.
Marc-André Lemburg [Sun, 11 Aug 2002 12:23:04 +0000 (12:23 +0000)]
Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.

u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.

Closes SF bug #593581.

22 years agoImplement stage B0 of PEP 237: add warnings for operations that
Guido van Rossum [Sun, 11 Aug 2002 04:24:12 +0000 (04:24 +0000)]
Implement stage B0 of PEP 237: add warnings for operations that
currently return inconsistent results for ints and longs; in
particular: hex/oct/%u/%o/%x/%X of negative short ints, and x<<n that
either loses bits or changes sign.  (No warnings for repr() of a long,
though that will also change to lose the trailing 'L' eventually.)

This introduces some warnings in the test suite; I'll take care of
those later.

22 years agotest_saveall(): Another small simplification; plus s/l/L/g.
Tim Peters [Sun, 11 Aug 2002 04:15:09 +0000 (04:15 +0000)]
test_saveall():  Another small simplification; plus s/l/L/g.
test_del(), test_del_newclass():  No need to use apply() in these.