Neal Norwitz [Mon, 17 Feb 2003 18:05:20 +0000 (18:05 +0000)]
Use correct function name to PyArg_ParseTuple("is_package").
Fix off-by-1 error in normalize_line_endings():
when *p == '\0' the NUL was copied into q and q was auto-incremented,
the loop was broken out of,
then a newline was appended followed by a NUL.
So the function, in effect, was strcpy() but added two extra chars
which was caught by obmalloc in debug mode, since there was only
room for 1 additional newline.
Get test working under regrtest (added test_main).
Jack Jansen [Mon, 17 Feb 2003 16:47:12 +0000 (16:47 +0000)]
When installing resource files whose name ends in .rsrc use the
"copy anything to a data fork based resource file" trick of macresource.
Fixes #688007.
Andrew MacIntyre [Mon, 17 Feb 2003 09:17:50 +0000 (09:17 +0000)]
Tweak to Skip's checkin of patch 686397:
- 'os2' references in ntpath.py relate to the VACPP port, not the EMX port;
- the VACPP port uses the same defpath as all other ntpath.py supported
platforms except 'ce'.
Tim Peters [Sat, 15 Feb 2003 03:01:11 +0000 (03:01 +0000)]
cPickle.c, load_build(): Taught cPickle how to pick apart
the optional proto 2 slot state.
pickle.py, load_build(): CAUTION: Noted that cPickle's
load_build and pickle's load_build really don't do the same
things with the state, and didn't before this patch either.
cPickle never tries to do .update(), and has no backoff if
instance.__dict__ can't be retrieved. There are no tests
that can tell the difference, and part of what cPickle's
load_build() did looked accidental to me, so I don't know
what the true intent is here.
pickletester.py, test_pickle.py: Got rid of the hack for
exempting cPickle from running some of the proto 2 tests.
Guido van Rossum [Fri, 14 Feb 2003 19:29:22 +0000 (19:29 +0000)]
- The audio driver tests (test_ossaudiodev.py and
test_linuxaudiodev.py) are no longer run by default. This is
because they don't always work, depending on your hardware and
software. To run these tests, you must use an invocation like
./python Lib/test/regrtest.py -u audio test_ossaudiodev
Jack Jansen [Fri, 14 Feb 2003 14:11:59 +0000 (14:11 +0000)]
Factored out classes for handling source and binary distributions. Source
now means "distutils-based source", binary "bdist format archive". Also
fixed various lurking bugs.
Guido van Rossum [Thu, 13 Feb 2003 22:07:59 +0000 (22:07 +0000)]
- Finally fixed the bug in compile() and exec where a string ending
with an indented code block but no newline would raise SyntaxError.
This would have been a four-line change in parsetok.c... Except
codeop.py depends on this behavior, so a compilation flag had to be
invented that causes the tokenizer to revert to the old behavior;
this required extra changes to 2 .h files, 2 .c files, and 2 .py
files. (Fixes SF bug #501622.)
Tim Peters [Thu, 13 Feb 2003 19:30:57 +0000 (19:30 +0000)]
We didn't have any tests making pickles with one of {pickle, cPickle},
and loading them via the other, except for the special cases of this
Guido added to test_datetime.py for datetime module objects. The new
test_xpickle.py tries all of pickletester's AbstractPickleTests in
both x-module ways.
Tim Peters [Thu, 13 Feb 2003 18:24:14 +0000 (18:24 +0000)]
Taught cPickle how to read pickles containing NEWOBJ. This won't get
exercised by the test suite before cPickle knows how to create NEWOBJ
too. For now, it was just tried once by hand (via loading a NEWOBJ
pickle created by pickle.py).
Guido van Rossum [Thu, 13 Feb 2003 16:30:16 +0000 (16:30 +0000)]
SF patch #685738 by Michael Stone.
This changes the default __new__ to refuse arguments iff tp_init is the
default __init__ implementation -- thus making it a TypeError when you
try to pass arguments to a constructor if the class doesn't override at
least __init__ or __new__.
Mark Hammond [Thu, 13 Feb 2003 12:05:15 +0000 (12:05 +0000)]
Use python_d.exe to build _ssl_d.pyd - we can not express that we depend
on a release 'python.exe' for a debug build of _ssl. It may happen that
Python.exe is currently broken, and we are trying to rebuild from scratch.
Tim Peters [Thu, 13 Feb 2003 03:13:40 +0000 (03:13 +0000)]
socket_inet_aton(): ip_addr was left undefined before use in the
!HAVE_INET_ATON case. Repaired that, and tried to repair what looked
like out-of-date comments.
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).