| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
vgetargskeywords(): Now that this routine is checking for bad input
(rather than dump core in some cases), some bad calls are raising errors
that previously "worked". This patch makes the error strings more
revealing, and changes the exceptions from SystemError to RuntimeError
(under the theory that SystemError is more of a "can't happen!" assert-
like thing, and so inappropriate for bad arguments to a public C API
function).
|
|
|
|
|
| |
Also change all the helper functions to pass along the size of the
msgbuf and use PyOS_snprintf() when writing into the buffer.
|
| |
|
|
|
|
|
|
| |
seterror() uses a char array and a pointer to the current position in
that array. Use snprintf() and compute the amount of space left in
the buffer based on the current pointer position.
|
|
|
|
|
|
| |
If it returns -1 (which indicates overflow on old Linux platforms and
perhaps on Windows) or size greater than buffer, write a message
indicating that the previous message was truncated.
|
|
|
|
| |
overrun avoidance.
|
|
|
|
| |
overrun avoidance.
|
|
|
|
|
|
|
|
| |
com_arglist(), symtable_check_unoptimized(), symtable_params(),
symtable_global(), symtable_list_comprehension():
Conversion of sprintf() to PyOS_snprintf() for buffer overrun
avoidance.
|
| |
|
|
|
|
|
| |
Also replace a switch statement with one case and a default to an
if/else.
|
| |
|
|
|
|
|
| |
Just being sure. The old code looks like it was safe, but there's no
harm in double-checking.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PyEval_EvalCodeEx(): increment tstate->recursion_depth around the
decref of the frame, because the C stack for this call is still in
use and the decref can lead to __del__ methods getting called.
While this gives tstate->recursion_depth a value proportional to the
depth of the C stack (instead of a small constant no matter how
deeply __del__s recurse), it's not enough to stop the reported crash
when using the default recursion limit on Windows.
Bugfix candidate.
|
|
|
|
|
|
|
| |
Bugfix candidate.
tb_displayline(): the sprintf format was choking off the file name, but
used plain %s for the function name (which can be arbitrarily long).
Limit both to 500 chars max.
|
| |
|
|
|
|
| |
what it is more carefully and point out some of the subtleties.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
uninitialized memory reads reported in bug #478001.
Note that this doesn't address the following larger issues:
- Error conditions are not documented for PyOS_*sig() in the C API.
- Nothing that actually calls PyOS_*sig() in the core interpreter and
extension modules actually /checks/ the return value of the call.
Fixing those is left as an exercise for a later day.
|
| |
|
| |
|
|
|
|
|
|
| |
Easy enough to catch assignment in the compiler. The perverse user
can still change the value of __debug__, but that may be the least he
can do.
|
| |
|
| |
|
|
|
|
|
|
| |
This patch boosts performance for comparing identical string object
by some 20% on my machine while not causing any noticable slow-down
for other operations (according to tests done with pybench).
|
|
|
|
| |
modules. Idea by Donovan Preston, implementaion by me.
|
|
|
|
| |
Changes enabling Python to compile under OS/2 Visual Age C++.
|
|
|
|
|
| |
PyNode_CompileSymtable: if symtable_init() fails, free the memory
allocated for the PyFutureFeatures struct.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Muller.
|
|
|
|
| |
submodule imports: the frozen import goes through a different mechanism.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
+ 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>.
|
|
|
|
| |
we're ensuring that's true during the format parse, get rid of nkwlist.
|
| |
|
|
|
|
|
| |
the format, instead of waiting until after we can overindex it by
mistake.
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
dict API everywhere on it instead of sometimes using the slower mapping
API.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
+ 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.
|
|
|
|
|
|
| |
+ 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.
|
|
|
|
|
|
|
| |
+ 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.
|
|
|
|
|
|
|
| |
+ 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>).
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
removing useless obfuscation.
|
|
|
|
|
|
| |
to call the corresponding methods. This is not a performance improvement
since the times are still swamped by disk I/O, but cleans up the code just
a little.
|
|
|
|
| |
PyArg_UnpackTuple().
|
| |
|
|
|
|
| |
Fulton, based on code Jim supplied.
|