]> granicus.if.org Git - python/log
python
23 years agoSF bug #477221: abs and divmod act oddly with -0.0.
Tim Peters [Thu, 1 Nov 2001 20:09:42 +0000 (20:09 +0000)]
SF bug #477221: abs and divmod act oddly with -0.0.
Partial fix.
float_abs():  ensure abs(-0.0) returns +0.0.
Bugfix candidate.

23 years agoCorrect misspelling of "separate" in two places.
Fred Drake [Thu, 1 Nov 2001 19:48:01 +0000 (19:48 +0000)]
Correct misspelling of "separate" in two places.
This closes SF bug #476898.

23 years agohas_finalizer(): simplified "if (complicated_bool) 1 else 0" to
Tim Peters [Thu, 1 Nov 2001 19:35:45 +0000 (19:35 +0000)]
has_finalizer():  simplified "if (complicated_bool) 1 else 0" to
"complicated_bool".

23 years agoBrute-force performance hackery; buys back about 20% of the time for
Fred Drake [Thu, 1 Nov 2001 17:50:38 +0000 (17:50 +0000)]
Brute-force performance hackery; buys back about 20% of the time for
saferepr(), a bit less for pformat().

23 years agoAdd has_finalizer predictate function. Use it when deciding which
Neil Schemenauer [Thu, 1 Nov 2001 17:35:23 +0000 (17:35 +0000)]
Add has_finalizer predictate function.  Use it when deciding which
objects to save in gc.garbage.  This should be the last change needed to
fix SF bug 477059: "__del__ on new classes vs. GC".

Note that this change slightly changes the behavior of the collector.
Before, if a cycle was found that contained instances with __del__
methods then all instance objects in that cycle were saved in
gc.garbage.  Now, only objects with __del__ methods are saved in
gc.garbage.

23 years agoThe import check in setup.py fails on Mac OS X for Carbon-based modules
Jack Jansen [Thu, 1 Nov 2001 14:44:15 +0000 (14:44 +0000)]
The import check in setup.py fails on Mac OS X for Carbon-based modules
if you are not building while logged in to the console (you cannot
connect to the window server, so the Carbon library doesn't initialize).
Added a quick hack to skip the import test, with a warning, for modules
linked against Carbon.

23 years agoSF bug #477059 (my own): __del__ on new classes vs. GC.
Guido van Rossum [Thu, 1 Nov 2001 14:23:28 +0000 (14:23 +0000)]
SF bug #477059 (my own): __del__ on new classes vs. GC.

When moving objects with a __del__ attribute to a special list, look
for __del__ on new-style classes with the HEAPTYPE flag set as well.
(HEAPTYPE means the class was created by a class statement.)

23 years agoUnder MachO-Python unconditionally import macfsn.
Jack Jansen [Thu, 1 Nov 2001 14:00:19 +0000 (14:00 +0000)]
Under MachO-Python unconditionally import macfsn.

23 years ago__del__ is done -- except for the GC issue.
Guido van Rossum [Thu, 1 Nov 2001 04:11:06 +0000 (04:11 +0000)]
__del__ is done -- except for the GC issue.

23 years agoMake the gc.collect() function respect the collection lock. This fixes
Neil Schemenauer [Wed, 31 Oct 2001 23:09:35 +0000 (23:09 +0000)]
Make the gc.collect() function respect the collection lock.  This fixes
SF bug 476129: "gc.collect sometimes hangs".

23 years agoWorkaround for odd problem on my machine: without this I get a traceback
Just van Rossum [Wed, 31 Oct 2001 22:58:23 +0000 (22:58 +0000)]
Workaround for odd problem on my machine: without this I get a traceback
if I hit enter instead of return upon file selection.

23 years agoMoved macfsn hackery from macmain.c to macfsmodule.c so it loads
Just van Rossum [Wed, 31 Oct 2001 22:55:08 +0000 (22:55 +0000)]
Moved macfsn hackery from macmain.c to macfsmodule.c so it loads
on demand instead of at startup.

23 years agofix for
Michael W. Hudson [Wed, 31 Oct 2001 18:51:01 +0000 (18:51 +0000)]
fix for

[ #476557 ] Wrong error message for file.write(a, b)

Makes file.write a METH_VARARGS function.

23 years agoFix markup typo
Andrew M. Kuchling [Wed, 31 Oct 2001 13:16:10 +0000 (13:16 +0000)]
Fix markup typo

23 years agoAdd paragraph about difflib suggested by David Goodger
Andrew M. Kuchling [Wed, 31 Oct 2001 13:13:36 +0000 (13:13 +0000)]
Add paragraph about difflib suggested by David Goodger
Bump version number

23 years agocall the correct base method (found due to better inheritance checking in 2.2)
Just van Rossum [Wed, 31 Oct 2001 12:55:07 +0000 (12:55 +0000)]
call the correct base method (found due to better inheritance checking in 2.2)

23 years agoLink the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen [Wed, 31 Oct 2001 12:11:48 +0000 (12:11 +0000)]
Link the core with CoreServices, not with Carbon, and don't use any Carbon
routines. As of 10.1 using Carbon will crash Python if no window server is
available (ssh connection, console mode, MacOSX Server). This fixes bug
#466907.

A result of this mod is that the default 8bit encoding on OSX is now ASCII,
for the time being. Also, the extension modules that need the Carbon
framework now explicitly include it in setup.py.

23 years agoRegenerated
Jack Jansen [Wed, 31 Oct 2001 11:41:25 +0000 (11:41 +0000)]
Regenerated

23 years agoDocumentation patches by bsherwood
Chui Tey [Wed, 31 Oct 2001 10:40:28 +0000 (10:40 +0000)]
Documentation patches by bsherwood

23 years agoAdded structseq.c
Just van Rossum [Wed, 31 Oct 2001 10:27:19 +0000 (10:27 +0000)]
Added structseq.c

23 years agoAdded Donovan Preston and reformatted to 80-char lines.
Jack Jansen [Wed, 31 Oct 2001 10:13:52 +0000 (10:13 +0000)]
Added Donovan Preston and reformatted to 80-char lines.

23 years agoMove a name into correct position.
Tim Peters [Wed, 31 Oct 2001 04:45:45 +0000 (04:45 +0000)]
Move a name into correct position.

23 years agoSF patch #474485: pydoc generates some bad html, from Rich Salz.
Tim Peters [Wed, 31 Oct 2001 04:20:26 +0000 (04:20 +0000)]
SF patch #474485:  pydoc generates some bad html, from Rich Salz.

23 years agoSF patch #474500: Make OS/2 locks work like posix locks, from Michael
Tim Peters [Wed, 31 Oct 2001 03:50:45 +0000 (03:50 +0000)]
SF patch #474500:  Make OS/2 locks work like posix locks, from Michael
Muller.

23 years agoHuh. In an effort to be less thorough <wink>, seems I checked in a new
Tim Peters [Wed, 31 Oct 2001 03:46:14 +0000 (03:46 +0000)]
Huh.  In an effort to be less thorough <wink>, seems I checked in a new
test that wouldn't even compile,

23 years agoFix bad bug in structseq slicing (NULL pointers in result). Reported by
Tim Peters [Tue, 30 Oct 2001 23:20:46 +0000 (23:20 +0000)]
Fix bad bug in structseq slicing (NULL pointers in result).  Reported by
Jack Jansen on python-dev.
Add simple test case.
Move vereq() from test_descr to test_support (it's handy!).

23 years agoMod by Donovan Preston to allow MacPython to live in a Python.app bundle and understa...
Jack Jansen [Tue, 30 Oct 2001 22:48:36 +0000 (22:48 +0000)]
Mod by Donovan Preston to allow MacPython to live in a Python.app bundle and understand the __main__.py convention used there for applets. This gives us applets that work on both OS9 and OSX! (Although "applet" may not be the correct word for something that is going to be multimegabyte:-).

But: the code is currently disabled, as it requires CodeWarrior 7 and I'm still using 6.

23 years agoFiles used for MacPython 2.2b1 distribution.
Jack Jansen [Tue, 30 Oct 2001 22:42:45 +0000 (22:42 +0000)]
Files used for MacPython 2.2b1 distribution.

23 years agoFix grammar error
Andrew M. Kuchling [Tue, 30 Oct 2001 22:18:21 +0000 (22:18 +0000)]
Fix grammar error

23 years agoRewrites and additions resulting from today's feedback
Andrew M. Kuchling [Tue, 30 Oct 2001 21:36:04 +0000 (21:36 +0000)]
Rewrites and additions resulting from today's feedback

23 years agoSF bug #474077 2.2b1: Error compiling extns with BCC
Tim Peters [Tue, 30 Oct 2001 21:09:55 +0000 (21:09 +0000)]
SF bug #474077 2.2b1: Error compiling extns with BCC
Removed "#undef HAVE_HYPOT" line from Borland config, as suggested.
Whether this will break some other Borland usage is a good question I
can't answer.

23 years agoAlways use --dvips-safe when generating HTML for the standard documentation
Fred Drake [Tue, 30 Oct 2001 16:28:46 +0000 (16:28 +0000)]
Always use --dvips-safe when generating HTML for the standard documentation
since we do not have anything that causes dvips to be run except when
PostScript is specifically requested, which is a separate target.

23 years agoAdd a new option, --dvips-safe, which sets the $DVIPS_SAFE option in
Fred Drake [Tue, 30 Oct 2001 16:09:51 +0000 (16:09 +0000)]
Add a new option, --dvips-safe, which sets the $DVIPS_SAFE option in
LaTeX2HTML.  This is not safe to do in general (for the reasons LaTeX2HTML
protects against dvips to begin with), but is safe if we do not actually
need to run dvips.  Note that we also assume it is safe if the user
specifically requests PostScript generation.  See the comments for further
explanation.

23 years agoVarious minor rewrites
Andrew M. Kuchling [Tue, 30 Oct 2001 14:35:03 +0000 (14:35 +0000)]
Various minor rewrites
Bump version number

23 years agoCorrections noted by Michael McLay
Andrew M. Kuchling [Tue, 30 Oct 2001 14:22:11 +0000 (14:22 +0000)]
Corrections noted by Michael McLay

23 years ago/F observes that we need an else: in connect()
Jeremy Hylton [Tue, 30 Oct 2001 14:16:17 +0000 (14:16 +0000)]
/F observes that we need an else: in connect()

23 years agoDon't override asplit_pat in Scanner_UH3. No reason to do so, and it broke
Jack Jansen [Tue, 30 Oct 2001 13:11:24 +0000 (13:11 +0000)]
Don't override asplit_pat in Scanner_UH3. No reason to do so, and it broke
generating Waste.

23 years agoOn the macintosh don't take a quick exit in find_module() for frozen submodule import...
Jack Jansen [Tue, 30 Oct 2001 13:08:39 +0000 (13:08 +0000)]
On the macintosh don't take a quick exit in find_module() for frozen submodule imports: the frozen import goes through a different mechanism.

23 years agoPromote file objects out of the "Other Objects" category, so they become
Fred Drake [Tue, 30 Oct 2001 06:23:14 +0000 (06:23 +0000)]
Promote file objects out of the "Other Objects" category, so they become
visible in the table of contents.

23 years agoPromote built-in functions to come before built-in types.
Fred Drake [Tue, 30 Oct 2001 06:22:02 +0000 (06:22 +0000)]
Promote built-in functions to come before built-in types.

23 years agoWhitespace normalization.
Tim Peters [Tue, 30 Oct 2001 05:56:40 +0000 (05:56 +0000)]
Whitespace normalization.

23 years agoMention the new file() builtin in the section on file objects.
Tim Peters [Tue, 30 Oct 2001 05:54:04 +0000 (05:54 +0000)]
Mention the new file() builtin in the section on file objects.

23 years agoTo cover a recent checkin, added a test to ensure dir(None) == dir(Ellipsis).
Tim Peters [Tue, 30 Oct 2001 05:45:26 +0000 (05:45 +0000)]
To cover a recent checkin, added a test to ensure dir(None) == dir(Ellipsis).

23 years agoJust changed some continued-line indentation to read better, due to
Tim Peters [Tue, 30 Oct 2001 05:41:07 +0000 (05:41 +0000)]
Just changed some continued-line indentation to read better, due to
the earlier s/dictionary/dict/ change.

23 years agoFix SF bug #456386: test_commands regression failure (Andrew Dalke)
Guido van Rossum [Tue, 30 Oct 2001 03:17:30 +0000 (03:17 +0000)]
Fix SF bug #456386: test_commands regression failure (Andrew Dalke)

    test_commands does not work on IRIX

    It assumes the output of "ls /bin/ls" is a line
    that starts with a '-'. On IRIX that file is
    a symbolic link, so the first character is an l.
    This causes test_getstatus to fail.

23 years agoNews and attribution for SF bug #473009.
Guido van Rossum [Tue, 30 Oct 2001 03:03:03 +0000 (03:03 +0000)]
News and attribution for SF bug #473009.

23 years agoChange the limit on the input size for b2a_base64 to what will fit in
Guido van Rossum [Tue, 30 Oct 2001 03:00:52 +0000 (03:00 +0000)]
Change the limit on the input size for b2a_base64 to what will fit in
memory, rather than the standard's 57.

This fixes SF bug #473009.

23 years agoAdd values to tp_getattro and tp_flags so that dir(Ellipsis) will
Guido van Rossum [Tue, 30 Oct 2001 02:40:52 +0000 (02:40 +0000)]
Add values to tp_getattro and tp_flags so that dir(Ellipsis) will
return the same as dir(None).

23 years agoMinimal test for __del__ hook.
Guido van Rossum [Tue, 30 Oct 2001 02:33:02 +0000 (02:33 +0000)]
Minimal test for __del__ hook.

23 years agoPySocketSock_connect_ex(): On Windows, return the correct Windows exit
Tim Peters [Tue, 30 Oct 2001 01:26:49 +0000 (01:26 +0000)]
PySocketSock_connect_ex():  On Windows, return the correct Windows exit
code.  The patch is from Jeremy, and allows test_asynchat to run again.
Bugfix candidate.

23 years agodirectory chooser (requires a recent version of Tk)
Fredrik Lundh [Mon, 29 Oct 2001 22:58:55 +0000 (22:58 +0000)]
directory chooser (requires a recent version of Tk)

23 years agoRename "dictionary" (type and constructor) to "dict".
Tim Peters [Mon, 29 Oct 2001 22:25:45 +0000 (22:25 +0000)]
Rename "dictionary" (type and constructor) to "dict".

23 years agoAdd __del__ callbacks. They are too useful to leave out.
Guido van Rossum [Mon, 29 Oct 2001 22:11:00 +0000 (22:11 +0000)]
Add __del__ callbacks.  They are too useful to leave out.

XXX Remaining problems:

- The GC module doesn't know about these; I think it has its reasons
  to disallow calling __del__, but for now, __del__ on new-style
  objects is called when the GC module discards an object, for better
  or for worse.

- The code to call a __del__ handler is really ridiculously
  complicated, due to all the different debug #ifdefs.  I've copied
  this from the similar code in classobject.c, so I'm pretty sure I
  did it right, but it's not pretty. :-(

- No tests yet.

23 years agoSF bug #476138: tempfile behavior across platforms
Tim Peters [Mon, 29 Oct 2001 21:46:08 +0000 (21:46 +0000)]
SF bug #476138:  tempfile behavior across platforms
Ensure that a tempfile can be closed any number of times without error.
This wasn't true on Windows.

23 years agoRevise the PDF support in the LaTeX style sheet. This still isn't quite
Fred Drake [Mon, 29 Oct 2001 21:02:28 +0000 (21:02 +0000)]
Revise the PDF support in the LaTeX style sheet.  This still isn't quite
right, but the tests for whether we are generating PDF are a bit more
readable, and some unnecessary indirection has been removed.

23 years agoUpdate to reflect changes to the low-level logreader: share the info
Fred Drake [Mon, 29 Oct 2001 20:57:23 +0000 (20:57 +0000)]
Update to reflect changes to the low-level logreader:  share the info
dictionary instead of building a new one, and provide an overridable method
to allow subclasses to catch ADD_INFO records that are not part of the
initial block of ADD_INFO records created by the profiler itself.

23 years agoAdd a test for the insertion of user-provided ADD_INFO records.
Fred Drake [Mon, 29 Oct 2001 20:54:01 +0000 (20:54 +0000)]
Add a test for the insertion of user-provided ADD_INFO records.

23 years agoAllow user code to call the addinfo() method on the profiler object.
Fred Drake [Mon, 29 Oct 2001 20:48:09 +0000 (20:48 +0000)]
Allow user code to call the addinfo() method on the profiler object.

23 years agoMake the low-level log-reader object export a dictionary mapping keys
Fred Drake [Mon, 29 Oct 2001 20:45:57 +0000 (20:45 +0000)]
Make the low-level log-reader object export a dictionary mapping keys
to lists of values, giving the contents of all the ADD_INFO records
seen so far.  This is initialized agressively when the log file is
opened, so that whoever is looking at the log reader can always see
the initial data loaded into the data stream.  ADD_INFO events later
in the log file continue to be reported to the application layer as
before.

Add a new method, addinfo(), to the profiler.  This can be used to
insert additional ADD_INFO records into the profiler log.

Fix the tp_flags and tp_name slots on the type objects.

23 years agodictionary -> dict
Andrew M. Kuchling [Mon, 29 Oct 2001 20:37:47 +0000 (20:37 +0000)]
dictionary -> dict

23 years agoFix two typos noted by Jens Quade
Andrew M. Kuchling [Mon, 29 Oct 2001 18:09:42 +0000 (18:09 +0000)]
Fix two typos noted by Jens Quade
Bump version number

23 years agoAdd additional information on exceptions from time.mktime() and related to
Fred Drake [Mon, 29 Oct 2001 18:01:24 +0000 (18:01 +0000)]
Add additional information on exceptions from time.mktime() and related to
improper time tuples passed to various functions.  Based on comments from
Andreas Jung.

23 years agoMore refcount information.
Fred Drake [Mon, 29 Oct 2001 17:43:14 +0000 (17:43 +0000)]
More refcount information.

23 years agoIgnore all *.tex files in the typesetting output directories since there are
Fred Drake [Mon, 29 Oct 2001 17:42:17 +0000 (17:42 +0000)]
Ignore all *.tex files in the typesetting output directories since there are
a bunch of them now.

23 years agoMake sure we generate versions of each file in the Python/C API manual with
Fred Drake [Mon, 29 Oct 2001 17:40:40 +0000 (17:40 +0000)]
Make sure we generate versions of each file in the Python/C API manual with
reference-count annotations; this is needed for the typeset forms of the
manuals.

23 years agoUse connect_ex() instead of connect().
Jeremy Hylton [Mon, 29 Oct 2001 16:44:37 +0000 (16:44 +0000)]
Use connect_ex() instead of connect().

Removes old XXX comment and possible source of long-delays.

23 years agoFix for SF bug 453099 -- select not defensive
Jeremy Hylton [Mon, 29 Oct 2001 16:32:19 +0000 (16:32 +0000)]
Fix for SF bug 453099 -- select not defensive
And SF patch 473223 -- infinite getattr loop

Wrap select() and poll() calls with try/except for EINTR.  If EINTR is
raised, treat as a response where no fd is ready.

In dispatcher constructor, make sure self.socket is always
initialized.

23 years agoFix some markup errors noted by MH
Andrew M. Kuchling [Mon, 29 Oct 2001 15:47:33 +0000 (15:47 +0000)]
Fix some markup errors noted by MH
Use attribute assignment to illustrate __slots__ raising an error

23 years agoWhen overriding __str__ or __repr__, set the tp_print slot to NULL.
Guido van Rossum [Mon, 29 Oct 2001 14:33:44 +0000 (14:33 +0000)]
When overriding __str__ or __repr__, set the tp_print slot to NULL.

23 years agomore loading from cfg files
Steven M. Gava [Mon, 29 Oct 2001 11:19:46 +0000 (11:19 +0000)]
more loading from cfg files

23 years agomore of config dialog reading from files
Steven M. Gava [Mon, 29 Oct 2001 08:05:34 +0000 (08:05 +0000)]
more of config dialog reading from files

23 years agoUse sendall() in the stream test instead of send().
Guido van Rossum [Mon, 29 Oct 2001 07:18:02 +0000 (07:18 +0000)]
Use sendall() in the stream test instead of send().

23 years agoTest sendall().
Guido van Rossum [Mon, 29 Oct 2001 07:14:10 +0000 (07:14 +0000)]
Test sendall().

23 years agoAdd 'sendall' to list of socket methods.
Guido van Rossum [Mon, 29 Oct 2001 07:13:53 +0000 (07:13 +0000)]
Add 'sendall' to list of socket methods.

23 years agoadded finditer sanity check
Fredrik Lundh [Sun, 28 Oct 2001 20:15:40 +0000 (20:15 +0000)]
added finditer sanity check

23 years agoOops. In the tp_name field, the name should be "_socket.socket", not
Guido van Rossum [Sun, 28 Oct 2001 12:31:33 +0000 (12:31 +0000)]
Oops.  In the tp_name field, the name should be "_socket.socket", not
"socket.socket" -- on Windows, "socket.socket" is the wrapper class.
Also added the module name to the SSL type (which is not a new-style
class -- I don't want to mess with it yet).

23 years agoPyObject_CallFunctionObArgs() ---> PyObject_CallFunctionObjArgs()
Fred Drake [Sun, 28 Oct 2001 02:39:03 +0000 (02:39 +0000)]
PyObject_CallFunctionObArgs() ---> PyObject_CallFunctionObjArgs()
PyObject_CallMethodObArgs() ---> PyObject_CallMethodObjArgs()

23 years agoNews about the socket type and the HP-UX port.
Guido van Rossum [Sat, 27 Oct 2001 22:28:54 +0000 (22:28 +0000)]
News about the socket type and the HP-UX port.

23 years agoMade SocketType and socket the same thing: a subclassable type whose
Guido van Rossum [Sat, 27 Oct 2001 22:20:47 +0000 (22:20 +0000)]
Made SocketType and socket the same thing: a subclassable type whose
constructor acts just like socket() before.  All three arguments have
a sensible default now; socket() is equivalent to
socket(AF_INET, SOCK_STREAM).

One minor issue: the socket() function and the SocketType had
different doc strings; socket.__doc__ gave the signature,
SocketType.__doc__ gave the methods.  I've merged these for now, but
maybe the list of methods is no longer necessary since it can easily
be recovered through socket.__dict__.keys().  The problem with keeping
it is that the total doc string is a bit long (34 lines -- it scrolls
of a standard tty screen).

Another general issue with the socket module is that it's a big mess.
There's pages and pages of random platform #ifdefs, and the naming
conventions are totally wrong: it uses Py prefixes and CapWords for
static functions.  That's a cleanup for another day...  (Also I think
the big starting comment that summarizes the API can go -- it's a
repeat of the docstring.)

23 years agoSF patch #475657 (Dietmar Schwertberger)
Guido van Rossum [Sat, 27 Oct 2001 21:16:16 +0000 (21:16 +0000)]
SF patch  #475657 (Dietmar Schwertberger)

RISCOS/Makefile:
include structseq and weakrefobject;
changes to keep command line length below 2048

RISCOS/Modules/riscosmodule.c:
typos from the stat structseq patch

Include/pyport.h:
don't re-#define __attribute__(__x) on RISC OS as it is already defined in c library

23 years agoSF bug #475327: type() produces incorrect error msg
Tim Peters [Sat, 27 Oct 2001 19:37:48 +0000 (19:37 +0000)]
SF bug #475327:  type() produces incorrect error msg

object.h:  Added PyType_CheckExact macro.

typeobject.c, type_new():

+ Use the new macro.
+ Assert that the arguments have the right types rather than do incomplete
  runtime checks "sometimes".
+ If this isn't the 1-argument flavor() of type, and there aren't 3 args
  total, produce a "types() takes 1 or 3 args" msg before
  PyArg_ParseTupleAndKeywords produces a "takes exactly 3" msg.

23 years agodictionary() constructor:
Tim Peters [Sat, 27 Oct 2001 18:27:48 +0000 (18:27 +0000)]
dictionary() constructor:
+ Change keyword arg name from "x" to "items".  People passing a mapping
  object can stretch their imaginations <wink>.
+ Simplify the docstring text.

23 years agovgetargskeywords()
Tim Peters [Sat, 27 Oct 2001 07:25:06 +0000 (07:25 +0000)]
vgetargskeywords()
+ Squash another potential buffer overrun.
+ Simplify the keyword-arg loop by decrementing the count of keywords
  remaining instead of incrementing Yet Another Variable; also break
  out early if the number of keyword args remaining hits 0.

Since I hit the function's closing curly brace with this patch, that's
enough of this for now <wink>.

23 years agovgetargskeywords: Now that it's clear that nkwlist must equal max, and
Tim Peters [Sat, 27 Oct 2001 07:00:56 +0000 (07:00 +0000)]
vgetargskeywords:  Now that it's clear that nkwlist must equal max, and
we're ensuring that's true during the format parse, get rid of nkwlist.

23 years agovgetargskeywords: Prevent another potential sprintf buffer overrun.
Tim Peters [Sat, 27 Oct 2001 06:53:00 +0000 (06:53 +0000)]
vgetargskeywords:  Prevent another potential sprintf buffer overrun.

23 years agovgetargskeywords: Verify kwlist has the required length while parsing
Tim Peters [Sat, 27 Oct 2001 06:42:16 +0000 (06:42 +0000)]
vgetargskeywords:  Verify kwlist has the required length while parsing
the format, instead of waiting until after we can overindex it by
mistake.

23 years agoPyObject_CallFunction(), PyObject_CallMethod(): Make sure we do not touch
Fred Drake [Sat, 27 Oct 2001 06:16:31 +0000 (06:16 +0000)]
PyObject_CallFunction(), PyObject_CallMethod():  Make sure we do not touch
the va_list until we are sure we have a format string and need to use it;
this avoid premature initialization and having to finalize it several
different places because of error returns.

23 years agovgetargskeywords: Removed all PyErr_Clear() calls. It's possible that
Tim Peters [Sat, 27 Oct 2001 06:14:32 +0000 (06:14 +0000)]
vgetargskeywords:  Removed all PyErr_Clear() calls.  It's possible that
this routine will report an error now when it didn't before, but, if so,
it's a legitimate error that should never have been suppressed.

23 years agovgetargskeywords: The keywords arg is a dict (if non-NULL), so use the
Tim Peters [Sat, 27 Oct 2001 05:50:39 +0000 (05:50 +0000)]
vgetargskeywords:  The keywords arg is a dict (if non-NULL), so use the
dict API everywhere on it instead of sometimes using the slower mapping
API.

23 years agovgetargskeywords: Removed one of the mysterious PyErr_Clear() calls.
Tim Peters [Sat, 27 Oct 2001 05:30:17 +0000 (05:30 +0000)]
vgetargskeywords:  Removed one of the mysterious PyErr_Clear() calls.
The "need" for this was probably removed by an earlier patch that stopped
the loop right before it from passing NULL to a dict lookup routine.
I still haven't convinced myself that the next loop is correct, so am
leaving the next mysterious PyErr_Clear() call in for now.

23 years agovgetargskeywords:
Tim Peters [Sat, 27 Oct 2001 05:07:41 +0000 (05:07 +0000)]
vgetargskeywords:
+ Generally test nkeywords against 0 instead of keywords against NULL
  (saves a little work if an empty keywords dict is passed, and is
  conceptually more on-target regardless).
+ When a call erroneously specifies a keyword argument both by position
  and by keyword name:
    - It was easy to provoke this routine into an internal buffer overrun
      by using a long argument name.  Now uses PyErr_format instead (which
      computes a safe buffer size).
    - Improved the error msg.

23 years agovgetargskeywords:
Tim Peters [Sat, 27 Oct 2001 04:45:34 +0000 (04:45 +0000)]
vgetargskeywords:
+ Got rid of now-redundant dict typecheck.
+ Renamed nkwds to nkwlist.  Now all the "counting" vrbls have names
  related to the things they're counting in an obvious way.

23 years agovgetargskeywords:
Tim Peters [Sat, 27 Oct 2001 04:38:11 +0000 (04:38 +0000)]
vgetargskeywords:
+ Renamed argslen to nargs.
+ Renamed kwlen to nkeywords.  This one was especially confusing because
  kwlen wasn't the length of the kwlist argument, but of the keywords
  argument.

23 years agovgetargskeywords:
Tim Peters [Sat, 27 Oct 2001 04:33:41 +0000 (04:33 +0000)]
vgetargskeywords:
+ Removed now-redundant tuple typecheck.
+ Renamed "tplen" local to "argslen" (it's the length of the "args"
  argument; I suppose "tp" was for "Tim Peters should rename me
  someday <wink>).

23 years agoPyArg_ParseTupleAndKeywords: return false on internal error, not -1 (I
Tim Peters [Sat, 27 Oct 2001 04:26:57 +0000 (04:26 +0000)]
PyArg_ParseTupleAndKeywords:  return false on internal error, not -1 (I
introduced this bug just a little while ago, when *adding* internal error
checks).

vgetargskeywords:  Rewrote the section that crawls over the format string.
+ Added block comment so it won't take the next person 15 minutes to
  reverse-engineer what it's doing.
+ Lined up the "else" clauses.
+ Rearranged the ifs in decreasing order of likelihood (for speed).

23 years agoPyArg_ParseTupleAndKeywords: do basic sanity checks on the arguments,
Tim Peters [Sat, 27 Oct 2001 03:58:40 +0000 (03:58 +0000)]
PyArg_ParseTupleAndKeywords:  do basic sanity checks on the arguments,
and raise an error if they're insane.
vgetargskeywords:  the same, except that since this is an internal routine,
just assert that the arguments are sane.

23 years agotuple(3,4,5,x=2) dumped core on my box. vgetargskeywords() overindexed
Tim Peters [Sat, 27 Oct 2001 00:46:09 +0000 (00:46 +0000)]
tuple(3,4,5,x=2) dumped core on my box.  vgetargskeywords() overindexed
the kwlist vector whenever there was a mix of positional and keyword
arguments, and the number of positional arguments exceeded the length
of the kwlist vector.  If there was just one more positional arg than
keyword, the kwlist-terminating NULL got passed to PyMapping_HasKeyString,
which set an internal error that vgetargskeywords() then squashed (but
it's impossible to say whether it knew it was masking an error).  If
more than one more positional argument, it went on to pass random trash
to PyMapping_HasKeyString, which is why the example at the start
happened to kill the process.

Pure bugfix candidate.

23 years agovgetargskeywords(): remove test that can't succeed. Not a bugfix, just
Tim Peters [Sat, 27 Oct 2001 00:17:34 +0000 (00:17 +0000)]
vgetargskeywords():  remove test that can't succeed.  Not a bugfix, just
removing useless obfuscation.

23 years agodict_constructor(): The last test was passing for the wrong reason (it
Tim Peters [Fri, 26 Oct 2001 20:57:38 +0000 (20:57 +0000)]
dict_constructor():  The last test was passing for the wrong reason (it
was intended to verify that sub-sequences of lengths 1 and 3 raise
ValueError, but was actually testing string lengths).

23 years agoFill in remaining XXX spots
Andrew M. Kuchling [Fri, 26 Oct 2001 20:37:55 +0000 (20:37 +0000)]
Fill in remaining XXX spots
        - Describe UnpackTuple()
        - Credit __unicode__ to MAL
Use \pep macro everywhere in body text.
   (Listening to "The Great Gate of Kiev" -- appropriately triumphal
    music for this check-in...)