Commit Graph

19190 Commits

Author SHA1 Message Date
Guido van Rossum 723aa97ef3 - Get rid of obsolete #define PATCHLEVEL.
- Change PY_VERSION (but not the numeric versions) to "2.2a1+".
2001-08-17 14:05:27 +00:00
Guido van Rossum 4066769b91 Fix core dump in repr() of instancemethod whose class==NULL. 2001-08-17 13:59:27 +00:00
Guido van Rossum 84a79a8d25 classic(),metods(): add tests to verify that a bound method without a
class has a correct repr().
2001-08-17 13:58:31 +00:00
Guido van Rossum f23c41d56a instance_getattr2(): rewritten to remove unnecessary stuff and
streamlined a bit.

instancemethod_descr_get(): don't bind an unbound method of a class
that's not a base class of the argument class.
2001-08-17 13:43:27 +00:00
Guido van Rossum 93018760bc classic(), methods(): add another test relating to unbound methods:
when an unbound method of class A is stored as a class variable of
class B, and class B is *not* a subclass of class A, that method
should *not* get bound to B instances.
2001-08-17 13:40:47 +00:00
Guido van Rossum cdf0d75897 Instance methods: allow a NULL value for im_class. 2001-08-17 12:07:34 +00:00
Guido van Rossum 7e1ff69271 Add early binding of methods to the 2nd metaclass example. 2001-08-17 11:55:58 +00:00
Guido van Rossum 309b566704 metaclass(): add tests for metaclasses written in Python: one that
subclasses type, one that doesn't (the latter isn't fully functional
yet).
2001-08-17 11:43:17 +00:00
Guido van Rossum 8d32c8b59f type_new(): only defer to the winning metatype if it's different from
the metatype passed in as an argument.  This prevents infinite
recursion when a metatype written in Python calls type.__new__() as a
"super" call.

Also tweaked some comments.
2001-08-17 11:18:38 +00:00
Tim Peters 4b046c252e Stop adding 3 to FD_SETSIZE -- it makes no sense. If it turns out it
actually does <wink>, perhaps an Insure run will catch it.
Also removed senseless Windows comment.
2001-08-16 21:59:46 +00:00
Fred Drake cb19976f1a fix_font(): Instead of using a long if/elsif cluster, use a bloody
dictionary.  Added some entries to the dictionary to fix part of
    SF bug #451556.
2001-08-16 21:56:24 +00:00
Fred Drake 457c4190f9 Fix typo reported by Joonas Paalasmaa: dada-->data 2001-08-16 21:25:24 +00:00
Fred Drake 739282da83 Re-write the description of the os.spawn*() functions, and cover the
whole family instead of just two.


This closes SF bug #451630.
2001-08-16 21:21:28 +00:00
Barry Warsaw f6365e0107 Added a test for module repr truncation when the package name is
really long.  Closes SF bug #437984.
2001-08-16 20:42:38 +00:00
Guido van Rossum 501c7c7d0e classobject.c:instancemethod_descr_get(): when a bound method is
assigned to a class variable and then accessed via an instance, it
should not be rebound.

test_descr.py:methods(): test for the condition above.
2001-08-16 20:41:56 +00:00
Barry Warsaw 2907fe6ce7 module_repr(): Instead of fixing the maximum buf size to 400,
calculate it on the fly.  This way even modules with long package
    names get an accurate repr instead of a truncated one.  The extra
    malloc/free cost shouldn't be a problem in a repr function.

    Closes SF bug #437984
2001-08-16 20:39:24 +00:00
Jack Jansen e791a6421f If genpluginprojects is called from fullbuild we set the Python source directory to be the same as fullbuild uses (in stead of using the default sys.prefix). This fixes an issue Mark Day raised that you can't use fullbuild with one Python installation to build another one. 2001-08-16 20:39:17 +00:00
Barry Warsaw 214a0b1382 init_sre(): Plug a little leak reported by Insure. 2001-08-16 20:33:48 +00:00
Andrew M. Kuchling 5aa3c4af76 Link readline module with ncurses in preference to termcap. [Bug ##441580]
Remove pointless comment
2001-08-16 20:30:18 +00:00
Andrew M. Kuchling db7aed5219 [Patch #441691] preprocess() method for Borland C compiler.
I have no way of testing this.
2001-08-16 20:17:41 +00:00
Tim Peters 4d2dded044 test_descr started breaking in yet another way in the same place. 2001-08-16 19:50:51 +00:00
Guido van Rossum 76e6963fc1 Fix object_repr() to include the module (using the same rules as
type_repr() for when to show or not to show it).
2001-08-16 18:52:43 +00:00
Fred Drake 3791838339 New unit test for the mimetypes module, to avoid future regressions. 2001-08-16 18:36:59 +00:00
Fred Drake c81a06998f Another egregious error that copied the encodings info over the suffix
info.  Caught by the tests that I'm writing now.
2001-08-16 18:14:38 +00:00
Martin v. Löwis c47016ee74 Use (c)StringIO for collecting bytes. Fixes bug #451622. 2001-08-16 17:06:44 +00:00
Tim Peters 63a8d69476 Repair some accidents causing Windows failures:
+ test_compare.  While None compares less than anything else, it's not
  always the case that None has the smallest id().
+ test_descr.  The output of %p (pointer) formats varies across platforms.
  In particular, on Windows it doesn't produce a leading "0x".
2001-08-16 16:56:16 +00:00
Barry Warsaw 2f7045576d Fixed a couple of minor formatting nits where lines were > 79 columns wide. 2001-08-16 16:55:10 +00:00
Barry Warsaw b44740f741 select_select(): Closing bug #448351 the easy way, i.e. by changing
the "#ifdef MS_WINDOWS" to "#ifdef SELECT_USES_HEAP" and by
    setting SELECT_USES_HEAP when FD_SETSIZE > 1024.

    The indirection seems useful since this subtly changes the path
    that "normal" Windows programs take (where Timmie sez FD_SETSIZE =
    512).  If that's a problem for Windows, he has only one place to
    change.
2001-08-16 16:52:59 +00:00
Fred Drake c019ecb7fe Bad bug: the MimeTypes.readfp() was supposed to take a file object as a
parameter, but did not.  This was found because it can create failures
elsewhere based on the presence of mime.types files in some common locations
the module searches by default.

(I will be writing a test for this module shortly!)
2001-08-16 15:54:28 +00:00
Guido van Rossum 360e031f8d I should add that the previous checkin also added a slight
optimization for dynamic classes.  If __getattr__ is not found as an
attribute on the type, slot_tp_getattro replaces itself with
PyObject_GenericGetAttr.  This means you can't add a __getattr__
method to a class after the fact -- but you can still *change* a
__getattr__ method into a different one.

(A similar restriction exists for classic classes.)
2001-08-16 15:42:49 +00:00
Just van Rossum 7a401795db Long time overdue: change sys.path defaults so that people will
have to do "from PIL import Image" instead of "import Image".
2001-08-16 15:16:19 +00:00
Fred Drake 7fdc0a1835 Use METH_O where possible (two functions). This does not lead to real
performance changes since the affected functions are not expected to be
used frequently, but reduces the volume of code.
2001-08-16 14:11:30 +00:00
Jack Jansen 1690409243 Updated to the current state of things (long overdue). 2001-08-16 14:10:56 +00:00
Jack Jansen 686a4a6d0f Removed expat from the access paths, it isn't needed. 2001-08-16 14:10:08 +00:00
Andrew M. Kuchling b1d6029437 [Patch #444854 from twburton]
Add executable extension, needed to get the program name right on Win32
2001-08-16 14:08:02 +00:00
Andrew M. Kuchling 6fb8d3a3d6 [Patch #442530 from twburton]
Provide include_dirs argument to all calls to ._preprocess and ._compile
    Fix typo: pattern.search(pattern) should be pattern.search(line)
2001-08-16 13:56:40 +00:00
Martin v. Löwis e3eb1f2b23 Patch #427190: Implement and use METH_NOARGS and METH_O. 2001-08-16 13:15:00 +00:00
Guido van Rossum c35422109b Fix SF bug #442501: calculate __module__ properly.
- type_module(), type_name(): if tp_name contains one or more period,
  the part before the last period is __module__, the part after that
  is __name__.  Otherwise, for non-heap types, __module__ is
  "__builtin__".  For heap types, __module__ is looked up in
  tp_defined.

- type_new(): heap types have their __module__ set from
  globals().__name__; a pre-existing __module__ in their dict is not
  overridden.  This is not inherited.

- type_repr(): if __module__ exists and is not "__builtin__", it is
  included in the string representation (just as it already is for
  classes).  For example <type '__main__.C'>.
2001-08-16 09:18:56 +00:00
Guido van Rossum 83f56cb2db Change the type names to xxsublist.<name>. 2001-08-16 09:10:42 +00:00
Guido van Rossum 297abadc6b The change of type(None).__name__ from 'None' to 'NoneType' broke this
test in a trivial way.  Fixed.
2001-08-16 08:32:39 +00:00
Guido van Rossum 8098ddbe81 Subtle change to make None.__class__ work:
- descrobject.c:descr_check(): only believe None means the same as
  NULL if the type given is None's type.

- typeobject.c:wrap_descr_get(): don't "conventiently" default an
  absent type to the type of the object argument.  Let the called
  function figure it out.
2001-08-16 08:27:33 +00:00
Guido van Rossum f6309e8ecf Oops. Two fixes for SF bug #422004 are not needed. :-) 2001-08-16 08:24:00 +00:00
Guido van Rossum 70d893a6aa Bunchathings:
- initsigs(): Ignore SIGXFZ so writing files beyond the file system
  size limit won't kill us.

- Py_Initialize(): call _Py_ReadyTypes() instead of readying types
  here.

- Py_Initialize(): call _PyImport_FixupExtension() for module
  "extensions".  (SF bug #422004.)
2001-08-16 08:21:42 +00:00
Guido van Rossum ba21a49f9d Add a function _Py_ReadyTypes() which initializes various and sundry
types -- currently Type, List, None and NotImplemented.  To be called
from Py_Initialize() instead of accumulating calls there.

Also rename type(None) to NoneType and type(NotImplemented) to
NotImplementedType -- naming the type identical to the object was
confusing.
2001-08-16 08:17:26 +00:00
Guido van Rossum 82fc51c19c Update to MvL's patch #424475 to avoid returning 2 when tp_compare
returns that.  (This fix is also by MvL; checkin it in because I want
to make more changes here.  I'm still not 100% satisfied -- see
comments attached to the patch.)
2001-08-16 08:02:45 +00:00
Tim Peters 49b253b173 No change, just wanted to record more info in the log: after the last
checkin, the Wise uninstaller *will* delete the Python DLL from the system
directory, but if and only if there wasn't a same-named Python DLL already
in the system directory at the time the installer ran.  That (no same-named
DLL) should be the typical case for most most people (I'm different because
I've run perhaps hundreds of 2.2 installs over the last several weeks).
IOW, the change was worth making.
2001-08-16 02:23:04 +00:00
Tim Peters fc7265ab42 Wise uninstallers never delete the Python DLL from the system directory.
They should.  Added a line that's supposed to fix that -- it doesn't
actually work on my box, but checking it in anyway.
2001-08-16 01:53:51 +00:00
Guido van Rossum a4ff6ab093 Add tests for overridable operators that have default interpretations
(__hash__ etc.), in static and dynamic classes, overridden and
default.
2001-08-15 23:57:59 +00:00
Guido van Rossum b8f636641f - Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
  dynamic classes and in static classes, overridden or not.  This
  affects __repr__, __str__, __hash__, __contains__, __nonzero__,
  __cmp__, and the rich comparisons (__lt__ etc.).  For dynamic
  classes, this meant copying a lot of code from classobject!  (XXX
  There are still some holes, because the comparison code in object.c
  uses PyInstance_Check(), meaning new-style classes don't get the
  same dispensation.  This needs more thinking.)

- Add object.__hash__, object.__repr__, object.__str__.  The __str__
  dispatcher now calls the __repr__ dispatcher, as it should.

- For static classes, the tp_compare, tp_richcompare and tp_hash slots
  are now inherited together, or not at all.  (XXX I fear there are
  still some situations where you can inherit __hash__ when you
  shouldn't, but mostly it's OK now, and I think there's no way we can
  get that 100% right.)
2001-08-15 23:57:02 +00:00
Just van Rossum ba634b2ec3 Rewrote Jack's latest change so it does what it intended to do... 2001-08-15 21:20:42 +00:00