Commit Graph

19601 Commits

Author SHA1 Message Date
Tim Peters 0ebeb584a4 PyUnicode_FromEncodedObject(): Repair memory leak in an error case. 2001-09-11 02:00:50 +00:00
Tim Peters c636f565b4 Added another test of str() applied to a string subclass instance,
involving embedded null bytes, since it's possible to screw that up w/o
screwing up cases w/o embedded nulls.
2001-09-11 01:52:02 +00:00
Tim Peters 5a49ade70e More on SF bug [#460020] bug or feature: unicode() and subclasses.
Repaired str(i) to return a genuine string when i is an instance of a str
subclass.  New PyString_CheckExact() macro.
2001-09-11 01:41:59 +00:00
Tim Peters 8ff70a9606 Fix tortured comment -- I must be on drugs today. 2001-09-10 23:53:53 +00:00
Tim Peters 4c3a0a35cd More on SF bug [#460020] bug or feature: unicode() and subclasses.
tuple(i) repaired to return a true tuple when i is an instance of a
tuple subclass.
Added PyTuple_CheckExact macro.
PySequence_Tuple():  if a tuple-like object isn't exactly a tuple, it's
not safe to return the object as-is -- make a new tuple of it instead.
2001-09-10 23:37:46 +00:00
Tim Peters caaff8d95d test_dir(): Add tests for dir(i) where i is a module subclass. 2001-09-10 23:12:14 +00:00
Jack Jansen 7b0494635b Prototype for PyMac_GetFullPathname(). 2001-09-10 22:09:30 +00:00
Jack Jansen 697842f58c Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
parameter for the return string (as unix pathnames are not limited
by the 255 char pstring limit).
Implemented the function for MachO-Python, where it returns unix pathnames.
2001-09-10 22:00:39 +00:00
Fredrik Lundh b0e8e9b72f more xmlrpclib tweaks: fixed repr(Fault()); enable UTF-8 parsing in
xmllib (on 2.0 and later)
2001-09-10 21:45:42 +00:00
Tim Peters 7a50f2536e More for SF bug [#460020] bug or feature: unicode() and subclasses
Repair float constructor to return a true float when passed a subclass
instance.  New PyFloat_CheckExact macro.
2001-09-10 21:28:20 +00:00
Jack Jansen c6249e9fef Superseded by Python 2.2.vct. 2001-09-10 21:03:06 +00:00
Tim Peters 64b5ce3a69 SF bug #460020: bug or feature: unicode() and subclasses.
Given an immutable type M, and an instance I of a subclass of M, the
constructor call M(I) was just returning I as-is; but it should return a
new instance of M.  This fixes it for M in {int, long}.  Strings, floats
and tuples remain to be done.
Added new macros PyInt_CheckExact and PyLong_CheckExact, to more easily
distinguish between "is" and "is a" (i.e., only an int passes
PyInt_CheckExact, while any sublass of int passes PyInt_Check).
Added private API function _PyLong_Copy.
2001-09-10 20:52:51 +00:00
Guido van Rossum 8b4e43e768 _portable_fseek():
Subtlety on Windows: if we change test_largefile.py to use a file
> 4GB, it still fails.  A debug session suggests this is because
fseek(fp, 0, 2) refuses to seek to the end of the file when the file
is > 4GB, because it uses the SetFilePointer() in 32-bit mode.

But it only fails when we seek relative to the end of the file,
because in the other seek modes only calls to fgetpos() and fsetpos()
are made, which use Get/SetFilePointer() in 64-bit mode.  Solution:
#ifdef MS_WInDOWS, replace the call to fseek(fp, ...) with a call to
_lseeki64(fileno(fp), ...).  Make sure to call fflush(fp) first.

(XXX Could also replace the entire branch with a call to _lseeki64().
Would that be more efficient?  Certainly less generated code.)

(XXX This needs more testing.  I can't actually test that it works for
files >4GB on my Win98 machine, because the filesystem here won't let
me create files >=4GB at all.  Tim should test this on his Win2K
machine.)
2001-09-10 20:43:35 +00:00
Fredrik Lundh c4c062f507 sync with pythonware codebase: much faster import (doesn't import
xmllib unless needed), merged docstring patches, added overridable
Transport.getparser to simplify plugging in different parsers.
2001-09-10 19:45:02 +00:00
Guido van Rossum 54328388f7 Another volunteer. 2001-09-10 19:00:21 +00:00
Guido van Rossum 8dbd3d8c50 PyObject_Dir():
- use PyModule_Check() instead of PyObject_TypeCheck(), now we can.
  - don't assert that the __dict__ gotten out of a module is always
    a dictionary; check its type, and raise an exception if it's not.
2001-09-10 18:27:43 +00:00
Guido van Rossum b875509310 PyModule_Check() now checks for subtype of module, as it should. 2001-09-10 18:21:59 +00:00
Andrew M. Kuchling d6e40e24f8 Remove some XXX markers
Update the patch and bug counts
2001-09-10 16:18:50 +00:00
Martin v. Löwis 5b718fc8a3 Use $(CC) -G to link shared libraries on Solaris. 2001-09-10 15:34:42 +00:00
Fred Drake ed5a7ca5ee Work around a LaTeX2HTML bug that caused the "m" in "mutable" to be dropped
in one place.
2001-09-10 15:16:08 +00:00
Guido van Rossum f49dcea233 Remove two XXX comments that have been resolved. 2001-09-10 15:03:48 +00:00
Guido van Rossum a31ddbbd7b Move the global variables 'size' and 'name' to the top -- these are
"module parameters", and used in the Windows test (which crashed
because size was undefined -- sigh).
2001-09-10 15:03:18 +00:00
Guido van Rossum d0b69eceb4 Improve threading on Solaris, according to SF patch #460269, submitted
by bbrox@bbrox.org / lionel.ulmer@free.fr.

This adds a configure check and if all goes well turns on the
PTHREAD_SCOPE_SYSTEM thread attribute for new threads.

This should remove the need to add tiny sleeps at the start of threads
to allow other threads to be scheduled.
2001-09-10 14:10:54 +00:00
Guido van Rossum 47f40343b3 Change the criteria for skipping the test.
If on Windows, we require the 'largefile' resource.

If not on Windows, we use a test that actually writes a byte beyond
the 2BG limit -- seeking alone is not sufficient, since on some
systems (e.g. Linux with glibc 2.2) the sytem call interface supports
large seek offsets but not all filesystem implementations do.

Note that on Windows, we do not use the write test: on Win2K, that
test can take a minute trying to zero all those blocks on disk, and on
Windows our code always supports large seek offsets (but again, not
all filesystems do).  This may mean that on Win95, or on certain other
backward filesystems, test_largefile will *fail*.
2001-09-10 13:34:12 +00:00
Jack Jansen fda3058827 Removed an erronous comment about alias files. 2001-09-10 08:55:25 +00:00
Andrew M. Kuchling 26c39bf1b5 Add section on long integer changes
Add removal of 3-arg pow() for floats
Rewrite introduction a bit
2001-09-10 03:20:53 +00:00
Guido van Rossum 531cf17309 Add a few more todo items. 2001-09-10 02:40:26 +00:00
Jeremy Hylton f649195560 Test the failed-unicode-decoding bug in PyArg_ParseTuple(). 2001-09-10 01:57:12 +00:00
Jeremy Hylton 77b8b67919 Fix core dump in PyArg_ParseTuple() with Unicode arguments.
Reported by Fredrik Lundh on python-dev.

The conversimple() code that handles Unicode arguments and converts
them to the default encoding now calls converterr() with the original
Unicode argument instead of the NULL returned by the failed encoding
attempt.
2001-09-10 01:54:43 +00:00
Tim Peters bea3fb83a7 Repair late-night doc typos. 2001-09-10 01:39:21 +00:00
Guido van Rossum 810cc51d5f This time (I hope) I've fixed largefile
support on Linux (and Solaris, I expect) for real.
The necessary symbols are defined once and for all,
under the assumption that they won't harm elsewhere.
2001-09-09 23:51:39 +00:00
Tim Peters a0a6222509 Teach regrtest how to pass on doctest failure msgs. This is done via a
horridly inefficient hack in regrtest's Compare class, but it's about as
clean as can be:  regrtest has to set up the Compare instance before
importing a test module, and by the time the module *is* imported it's too
late to change that decision.  The good news is that the more tests we
convert to unittest and doctest, the less the inefficiency here matters.
Even now there are few tests with large expected-output files (the new
cost here is a Python-level call per .write() when there's an expected-
output file).
2001-09-09 06:12:01 +00:00
Tim Peters 90ba8d9c80 Force "test." into the start of the module name, inherited by class and
type reprs, to accomodate the way Jack runs tests on the Mac.
2001-09-09 01:21:31 +00:00
Jack Jansen c432cba3f2 Install the dialog resources into the application bundle. The EasyDialogs
selftest now works.
2001-09-09 00:36:52 +00:00
Jack Jansen eb30843ea4 Don't call MacOS.SchedParams() in MachO, it doesn't exist. 2001-09-09 00:36:01 +00:00
Jack Jansen a48d4eaddf Minimal module to decode AppleSingle files (the way resource files are
stored in the CVS repository). It can either decode resource/data forks
in the standard Mac way or decode only the resource fork but store
the result in the data fork (the MacOSX preferred way). Finder info
and all other stuff is ignored.
2001-09-09 00:35:19 +00:00
cvs2svn f7adf2f473 This commit was manufactured by cvs2svn to create tag 'r22a3'. 2001-09-08 21:38:26 +00:00
Jack Jansen f7e571432a Final tweaks for 2.2a3 distribution. 2001-09-08 21:38:26 +00:00
Martin v. Löwis caef93d82c Silence warnings about passing unsigned char** as char**. 2001-09-08 16:23:34 +00:00
Jack Jansen 02646fe6d3 Oops, this file is very outdated. Removed. 2001-09-08 13:57:16 +00:00
Tim Peters 16a77adfbd Generalize operator.indexOf (PySequence_Index) to work with any
iterable object.  I'm not sure how that got overlooked before!

Got rid of the internal _PySequence_IterContains, introduced a new
internal _PySequence_IterSearch, and rewrote all the iteration-based
"count of", "index of", and "is the object in it or not?" routines to
just call the new function.  I suppose it's slower this way, but the
code duplication was getting depressing.
2001-09-08 04:00:12 +00:00
Tim Peters 2d84f2c95a It appears that unittest was changed to stop hoarding raw exception data,
saving instead a traceback string, but test_support's run_unittest was
still peeking into unittest internals and trying to pick apart unittest's
errors and failures vectors as if they contained exc_info() tuples instead
of strings.
Whatever, when a unittest-based test failed, test_support blew up.  I'm
not sure this is the right way to fix it; it simply gets me unstuck.
2001-09-08 03:37:56 +00:00
Tim Peters b07352e8b7 The usual post-release fiddling. 2001-09-08 01:25:47 +00:00
Guido van Rossum 28d80b1058 PyClass_New(): put the extended Don Beaudry hook back in. When one of
the base classes is not a classic class, and its class (the metaclass)
is callable, call the metaclass to do the deed.

One effect of this is that, when mixing classic and new-style classes
amongst the bases of a class, it doesn't matter whether the first base
class is a classic class or not: you will always get the error
"TypeError: metatype conflict among bases".  (Formerly, with a classic
class first, you'd get "TypeError: PyClass_New: base must be a class".)

Another effect is that multiple inheritance from ExtensionClass.Base,
with a classic class as the first class, transfers control to the
ExtensionClass.Base class.  This is what we need for SF #443239 (and
also for running Zope under 2.2a4, before ExtensionClass is replaced).
2001-09-07 21:08:32 +00:00
Guido van Rossum 8700b4281a PySequence_Check(), PyMapping_Check(): only return true if the
corresponding "getitem" operation (sq_item or mp_subscript) is
implemented.  I realize that "sequence-ness" and "mapping-ness" are
poorly defined (and the tests may still be wrong for user-defined
instances, which always have both slots filled), but I believe that a
sequence that doesn't support its getitem operation should not be
considered a sequence.  All other operations are optional though.

For example, the ZODB BTree tests crashed because PySequence_Check()
returned true for a dictionary!  (In 2.2, the dictionary type has a
tp_as_sequence pointer, but the only field filled is sq_contains, so
you can write "if key in dict".)  With this fix, all standalone ZODB
tests succeed.
2001-09-07 20:20:11 +00:00
Guido van Rossum 9478d07ee7 PyType_IsSubtype(): test tp_flags for HAVE_CLASS bit before accessing
a->tp_mro.  If a doesn't have class, it's considered a subclass only
of itself or of 'object'.

This one fix is enough to prevent the ExtensionClass test suite from
dumping core, but that doesn't say much (it's a rather small test
suite).  Also note that for ExtensionClass-defined types, a different
subclass test may be needed.  But I haven't checked whether
PyType_IsSubtype() is actually used in situations where this matters
-- probably it doesn't, since we also don't check for classic classes.
2001-09-07 18:52:13 +00:00
Barry Warsaw 317e9f5ef1 Bumping version numbers. 2001-09-07 18:23:30 +00:00
Barry Warsaw b5b786505e Merging in removal of this file from branch to trunk. 2001-09-07 18:20:04 +00:00
Barry Warsaw d6c8ca6536 Merging 2.2a3 branch changes back into trunk 2001-09-07 18:13:44 +00:00
Martin v. Löwis a3689fe786 Patch #438790: Add additional mappings.
Also remove mappings that are not registered with IANA, and not extensions.
2001-09-07 16:49:12 +00:00