| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
isinstance() now allows any object as the first argument and a class, a
type or something with a __bases__ tuple attribute for the second
argument. This closes SF patch #464992.
|
|
|
|
| |
(The rest of the test cases are trivial, so I don't feel too bad.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quoth the OpenSSL RAND_add man page:
OpenSSL makes sure that the PRNG state is unique for each
thread. On systems that provide /dev/urandom, the
randomness device is used to seed the PRNG transparently.
However, on all other systems, the application is
responsible for seeding the PRNG by calling RAND_add(),
RAND_egd(3) or RAND_load_file(3).
I decided to expose RAND_add() because it's general and RAND_egd()
because it's a useful special case. RAND_load_file() didn't seem to
offer much over RAND_add(), so I skipped it. Also supplied
RAND_status() which returns true if the PRNG is seeded and false if
not.
|
|
|
|
| |
closes patch 470254
|
|
|
|
|
|
|
|
|
| |
test_no_semis_header_splitter(): This actually should still split.
test_no_split_long_header(): An example of an unsplittable line.
test_no_semis_header_splitter(): Test for SF bug # 471918, Generator
splitting long headers.
|
|
|
|
|
|
|
|
| |
_split_header(): Split on folding whitespace if the attempt to split
on semi-colons failed.
_split_header(): Patch by Matthew Cowles for fixing SF bug # 471918,
Generator splitting long headers.
|
|
|
|
| |
PyType_HasFeature(t, Py_TPFLAGS_HAVE_CLASS).
|
|
|
|
| |
ValueError on too-large inputs.
|
|
|
|
|
|
| |
and fixup_slot_dispatchers() always select the proper slot dispatcher.
This affects slot_sq_item(), slot_tp_getattro(), and
slot_tp_getattr_hook().
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are now no known cases where the compiler package computes a
stack depth lower than the one computed by the builtin compiler. (To
achieve this state, we had to fix bugs in both compilers :-).
The chief change is to do the depth calculations with respect to basic
blocks. The stack effect of block is calculated. Then the flow graph
is traversed using breadth-first search to find the max weight path
through the graph.
Had to fix the StackDepthTracker to calculate the right info for
several opcodes: LOAD_ATTR, CALL_FUNCTION (and friends), MAKE_CLOSURE,
and DUP_TOPX.
XXX Still need to handle free variables in MAKE_CLOSURE.
XXX There are still a lot of places where the computed stack depth is
larger than for the builtin compiler. These won't cause the
interpreter to overflow the frame, but they waste space.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also minor tweaks to internal routines.
Use PyCF_MASK instead of explicit list of flags.
For the MAKE_CLOSURE opcode, the number of items popped off the stack
depends on both the oparg and the number of free variables for the
code object. Fix the code so it accounts for the free variables.
In com_classdef(), record an extra pop to account for the STORE call
after the BUILD_CLASS.
Get rid of some commented out debugging code in com_push() and
com_pop().
Factor string resize logic into helper routine com_check_size().
In com_addbyte(), remove redudant if statement after assert. (They
test the same condition.)
In several routines, use string macros instead of string functions.
|
| |
|
|
|
|
|
|
| |
d_type before calling the wrapped function.
fixup_slot_dispatchers(): fix indentation.
|
|
|
|
|
|
| |
- replace some log_error() calls with log_message()
- flush self.rfile before forking too (hope this works on Windows)
|
|
|
|
|
| |
Add --install-scripts=$(BINDIR) argument to "setup.py install"
invocation.
|
| |
|
|
|
|
| |
line fits in reasonable screen width.
|
| |
|
|
|
|
| |
Made the presence/absence of a semicolon after macros consistent.
|
|
|
|
|
|
|
| |
removed the tricks).
Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a
new block is neither necessary nor helpful).
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Apparently this patch (rev 2.41) replaced all the good old "s#"
formats in PyArg_ParseTuple() with "S". Then it did
PyString_FromStringAndSize() to get back the values setup by the
"s#" format. It also incref'd and decref'd the string obtained by
"S" even though the argument tuple had a reference to it.
Replace PyString_AsString() calls with PyString_AS_STRING().
A good rule of thumb -- if you never check the return value of
PyString_AsString() to see if it's NULL, you ought to be using the
macro <wink>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Many functions used a local variable called return_error, which was
initialized to zero. If an error occurred, it was set to true. Most
of the code paths checked were only executed if return_error was
false. goto is clearer.
The code also seemed to be written under the curious assumption that
calling Py_DECREF() on a local variable would assign the variable to
NULL. As a result, more of the error-exit code paths returned an
object that had a reference count of zero instead of just returning
NULL. Fixed the code to explicitly assign NULL after the DECREF.
A bit more reformatting, but not much.
XXX Need a much better test suite for zlib, since it the current tests
don't exercise any of this broken code.
|
|
|
|
| |
TeX-ified its docstring.
|
| |
|
|
|
|
|
| |
It sets a ZlibError exception, using the msg from the z_stream pointer
if one is available.
|
|
|
|
| |
passed to _beginthread().
|
| |
|
|
|
|
| |
masks any exception, not just AttributeError. Fix this.
|
|
|
|
|
| |
When PyString_FromStringAndSize() and _PyString_Resize() fail, they
set an exception. There's no need to set a new exception.
|
|
|
|
|
|
| |
Consistently indent 4 spaces.
Use whitespace around operators.
Put braces in the right places.
|
|
|
|
|
|
| |
This changes Pythread_start_thread() to return the thread ID, or -1
for an error. (It's technically an incompatible API change, but I
doubt anyone calls it.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mostly by Toby Dickenson and Titus Brown.
Add an optional argument to a decompression object's decompress()
method. The argument specifies the maximum length of the return
value. If the uncompressed data exceeds this length, the excess data
is stored as the unconsumed_tail attribute. (Not to be confused with
unused_data, which is a separate issue.)
Difference from SF patch: Default value for unconsumed_tail is ""
rather than None. It's simpler if the attribute is always a string.
|
|
|
|
| |
suggested in SF patch #424475. Also document exception return.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
object.c, PyObject_Str: Don't try to optimize anything except exact
string objects here; in particular, let str subclasses go thru tp_str,
same as non-str objects. This allows overrides of tp_str to take
effect.
stringobject.c:
+ string_print (str's tp_print): If the argument isn't an exact string
object, get one from PyObject_Str.
+ string_str (str's tp_str): Make a genuine-string copy of the object if
it's of a proper str subclass type. str() applied to a str subclass
that doesn't override __str__ ends up here.
test_descr.py: New str_of_str_subclass() test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an extension imports another extension in its
initXXX() function, the variable _Py_PackageContext is
prematurely reset to NULL. If the outer extension then
calls Py_InitModule(), the extension is installed in
sys.modules without its package name. The
manifestation of this bug is a "SystemError:
_PyImport_FixupExtension: module <package>.<extension>
not loaded".
To fix this, importdl.c just needs to retain the old
value of _Py_PackageContext and restore it after the
initXXX() method is called. The attached patch does this.
This patch applies to Python 2.1.1 and the current CVS.
|
|
|
|
|
| |
size(), parse150(): try int() first, catch OverflowError, fall back to
long().
|
| |
|
| |
|