Guido van Rossum [Wed, 12 Feb 2003 23:08:22 +0000 (23:08 +0000)]
Addressing SF bug #643005, implement socket.inet_aton() using
inet_aton() rather than inet_addr() -- the latter is obsolete because
it has a problem: "255.255.255.255" is a valid address but
indistinguishable from an error.
(I'm not sure if inet_aton() exists everywhere -- in case it doesn't,
I've left the old code in with an #ifdef.)
Guido van Rossum [Wed, 12 Feb 2003 21:46:11 +0000 (21:46 +0000)]
Provide access to the import lock, fixing SF bug #580952. This is
mostly from SF patch #683257, but I had to change unlock_import() to
return an error value to avoid fatal error.
Should this be backported? The patch requested this, but it's a new
feature.
Guido van Rossum [Wed, 12 Feb 2003 20:48:22 +0000 (20:48 +0000)]
Issue a warning when int('0...', 0) returns an int with the sign
folded; this will change in Python 2.4. On a 32-bit machine, this
happens for 0x80000000 through 0xffffffff, and for octal constants in
the same value range. No warning is issued if an explicit base is
given, *or* if the string contains a sign (since in those cases no
sign folding ever happens).
Guido van Rossum [Wed, 12 Feb 2003 17:05:26 +0000 (17:05 +0000)]
SF #660455 : patch by NNorwitz.
"Unsigned" (i.e., positive-looking, but really negative) hex/oct
constants with a leading minus sign are once again properly negated.
The micro-optimization for negated numeric constants did the wrong
thing for such hex/oct constants. The patch avoids the optimization
for all hex/oct constants.
Guido van Rossum [Wed, 12 Feb 2003 16:57:47 +0000 (16:57 +0000)]
SF #660455 : patch by NNorwitz.
"Unsigned" (i.e., positive-looking, but really negative) hex/oct
constants with a leading minus sign are once again properly negated.
The micro-optimization for negated numeric constants did the wrong
thing for such hex/oct constants. The patch avoids the optimization
for all hex/oct constants.
Jack Jansen [Wed, 12 Feb 2003 15:38:37 +0000 (15:38 +0000)]
Create applets slightly differently: by saving the sourcecode to a
temporary location. This is needed to makethings work with the new
buildtools based on bundlebuilder.
Jack Jansen [Wed, 12 Feb 2003 15:36:25 +0000 (15:36 +0000)]
- Better way to find site-packages
- Catch stderr as well as stdout
- Fixed a bug with non-installable packages
- Parse .pth files after installing, so you don't have to restart Python (or
the IDE) after installing.
Guido van Rossum [Wed, 12 Feb 2003 03:32:58 +0000 (03:32 +0000)]
SF #532767: isinstance(x, X) should work when x is a proxy for an X
instance, as long as x.__class__ is X or a subclass thereof.
Did a little cleanup of PyObject_IsInstance() too.
Tim Peters [Tue, 11 Feb 2003 22:43:24 +0000 (22:43 +0000)]
Implemented batching for dicts in cPickle. This is after two failed
attempts to merge the C list-batch and dict-batch code -- they worked, but
it was a godawful mess to read.
Jack Jansen [Tue, 11 Feb 2003 22:40:59 +0000 (22:40 +0000)]
Changed database format to make fields adhere to PEP 241 where
applicable, and use a similar naming scheme for other fields. This
has drastically changed the structure, as the PEP241 names aren't
identifiers.
Gustavo Niemeyer [Tue, 11 Feb 2003 18:46:20 +0000 (18:46 +0000)]
Unparenting BZ2File, as discussed in SF patch #661796.
* Modules/bz2module.c
(BZ2FileObject): Now the structure includes a pointer to a file object,
instead of "inheriting" one. Also, some members were copied from the
PyFileObject structure to avoid dealing with the internals of that
structure from outside fileobject.c.
(Util_GetLine,Util_DropReadAhead,Util_ReadAhead,Util_ReadAheadGetLineSkip,
BZ2File_write,BZ2File_writelines,BZ2File_init,BZ2File_dealloc,
BZ2Comp_dealloc,BZ2Decomp_dealloc):
These functions were adapted to the change above.
(BZ2File_seek,BZ2File_close): Use PyObject_CallMethod instead of
getting the function attribute locally.
(BZ2File_notsup): Removed, since it's not necessary anymore to overload
truncate(), and readinto() with dummy functions.
(BZ2File_methods): Added xreadlines() as an alias to BZ2File_getiter,
and removed truncate() and readinto().
(BZ2File_get_newlines,BZ2File_get_closed,BZ2File_get_mode,BZ2File_get_name,
BZ2File_getset):
Implemented getters for "newlines", "mode", and "name".
(BZ2File_init): Reworked to create a file instance instead of initializing
itself as a file subclass. Also, pass "name" object untouched to the
file constructor, and use PyObject_CallFunction instead of building the
argument tuple locally.
(BZ2File_Type): Set tp_new to PyType_GenericNew, tp_members to
BZ2File_members, and tp_getset to BZ2File_getset.
(initbz2): Do not set BZ2File_Type.tp_base nor BZ2File_Type.tp_new.
* Doc/lib/libbz2.tex
Do not mention that BZ2File inherits from the file type.
Guido van Rossum [Tue, 11 Feb 2003 18:44:42 +0000 (18:44 +0000)]
Put proper tests in classmethod_get(). Remove the type argument to
descr_check(); it wasn't useful. Change the type argument of the
various _get() methods to PyObject * because the call signature of
tp_descr_get doesn't guarantee its type.
Guido van Rossum [Tue, 11 Feb 2003 18:43:00 +0000 (18:43 +0000)]
Refactor instancemethod_descr_get() to (a) be more clear, (b) be safe
in the light of weird args, and (c) not to expect None (which is now
changed to NULL by slot_tp_descr_get()).
Tim Peters [Tue, 11 Feb 2003 17:18:58 +0000 (17:18 +0000)]
SF bug 684667: Modules/selectmodule.c returns NULL without exception set.
select_select() didn't set an exception in the SELECT_USES_HEAP case when
malloc() returned NULL.
Guido van Rossum [Tue, 11 Feb 2003 17:12:46 +0000 (17:12 +0000)]
Inline create_specialmethod() -- since METH_CLASS is done differently
now, it was only called once, and its existence merely obfuscates the
control flow.
Tim Peters [Tue, 11 Feb 2003 16:40:16 +0000 (16:40 +0000)]
Added tests to ensure that list and dict "chunking" are actually
getting done. Since this isn't yet implemented in cPickle, the
new tests are in TempAbstractPickleTests (which cPickle doesn't
run).
Guido van Rossum [Tue, 11 Feb 2003 16:25:43 +0000 (16:25 +0000)]
Add basic arg sanity checking to wrap_descr_get(). This is called
when Python code calls a descriptor's __get__ method. It should
translate None to NULL in both argument positions, and insist that at
least one of the argument positions is not NULL after this
transformation.
Guido van Rossum [Mon, 10 Feb 2003 21:31:27 +0000 (21:31 +0000)]
Get rid of the "bozo" __getstate__ that was inserted when __slots__
was used. This simplifies some logic in copy_reg.py (used by
pickling). It also broke a test, but this was rewritten to test the
new feature. :-)
Walter Dörwald [Mon, 10 Feb 2003 17:36:40 +0000 (17:36 +0000)]
Change filtertuple() to use tp_as_sequence->sq_item
instead of PyTuple_GetItem, so an overwritten __getitem__
in a tuple subclass works. SF bug #665835.
Jack Jansen [Mon, 10 Feb 2003 14:19:14 +0000 (14:19 +0000)]
- Better exception when the database isn't found.
- Allow for "manual:" pseudo-scheme in downloadURL to signal that
the download should be done manually.
Jack Jansen [Mon, 10 Feb 2003 14:02:33 +0000 (14:02 +0000)]
Pick up Makefile variable BASECFLAGS too. This is needed since OPT was
split into OPT and BASECFLAGS (Makefile.pre.in rev. 1.108), because
now there are essential CFLAGS in BASECFLAGS.
Walter Dörwald [Mon, 10 Feb 2003 13:19:13 +0000 (13:19 +0000)]
Change filterstring() and filterunicode(): If the
object is not a real str or unicode but an instance
of a subclass, construct the output via looping
over __getitem__. This guarantees that the result
is the same for function==None and function==lambda x:x
This doesn't happen for tuples, because filtertuple()
uses PyTuple_GetItem().
Just van Rossum [Mon, 10 Feb 2003 09:22:01 +0000 (09:22 +0000)]
My previous checkin caused compile() to no longer accept buffers, as noted
my MAL. Fixed. (Btw. eval() still doesn't take buffers, but that was so
even before my patch.)
Jack Jansen [Sun, 9 Feb 2003 23:10:20 +0000 (23:10 +0000)]
Strawman for a Package Install Manager for Python. It isn't CPAN yet, but at
less than 500 lines it already manages to test whether Numeric is installed,
and can install it if it isn't, including any prerequisites.
C Code:
* Removed the ifilter flag wart by splitting it into two simpler functions.
* Fixed comment tabbing in C code.
* Factored module start-up code into a loop.
Documentation:
* Re-wrote introduction.
* Addede examples for quantifiers.
* Simplified python equivalent for islice().
* Documented split of ifilter().
Tim Peters [Sat, 8 Feb 2003 03:46:31 +0000 (03:46 +0000)]
The Python implementation of datetime was changed in ways that no longer
tickle the 2.2.2 __cmp__ bug test_datetime used to tickle, so the
workarounds for that bug no longer make sense in the test suite (which I'm
still trying to keep as closely in synch as possible with Zope3's
version).
Tim Peters [Fri, 7 Feb 2003 22:50:28 +0000 (22:50 +0000)]
Comparison for timedelta, time, date and datetime objects: __eq__ and
__ne__ no longer complain if they don't know how to compare to the other
thing. If no meaningful way to compare is known, saying "not equal" is
sensible. This allows things like
if adatetime in some_sequence:
and
somedict[adatetime] = whatever
to work as expected even if some_sequence contains non-datetime objects,
or somedict non-datetime keys, because they only call __eq__.
It still complains (raises TypeError) for mixed-type comparisons in
contexts that require a total ordering, such as list.sort(), use as a
key in a BTree-based data structure, and cmp().
Somehow, copy() of a classic class object was handled
atomically, but deepcopy() didn't support this at all.
I don't see any reason for this, so I'm adding ClassType
to the set of types that are deep-copied atomically.
Jack Jansen [Fri, 7 Feb 2003 15:45:40 +0000 (15:45 +0000)]
Made AskFile* dialogs movable-modal by default, by providing a dummy
eventProc (which simply drops all events on the floor). Also added a
method SetDefaultEventProc through which frameworks can set a global
event handler (which can still be overridden on a per-call basis
with the eventProc argument).
* Eliminated tuple re-use in imap(). Doing it correctly made the code
too hard to read.
* Simplified previous changes to izip() to make it easier to read.
* Fixed typo in exception message for times()
* Filled in missing times_traverse()
* Document reasons that imap() did not adopt a None fill-in feature
* Document that count(sys.maxint) will wrap-around on overflow
* Add overflow test to islice()
* Check that starmap()'s argument returns a tuple
* Verify that imap()'s tuple re-use is safe
* Make a similar tuple re-use (with safety check) for izip()