Commit graph

19192 commits

Author SHA1 Message Date
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
Guido van Rossum
28962cc0ea Given a class without __cmp__ or __eq__, cmp() of two instances of
that class should compare the id() of those instances.  Add a test
that verifies this.  This test currently fails; I believe this is
caused by object.c:2.132 (Patch #424475 by loewis).
2001-08-15 21:02:20 +00:00
Fred Drake
ce1650f3a5 A large contribution from Dave Kuhlman describing what each of the slots
in the type object is used for, for many of the more commonly used slots.
Thanks!

(But there is still a lot more to write on this topic.)
Markup and organizational changes by your friendly neighborhood
documentation czar.
2001-08-15 19:07:18 +00:00
Fred Drake
87731762f2 Dave Kuhlman has contributed a nice improvement to the "Defining New Types"
section of the Extending & Embedding manual -- thanks!
2001-08-15 19:00:29 +00:00
Fred Drake
4e6a3fe0f6 Remove spurious space before a period. 2001-08-15 18:48:10 +00:00
Fred Drake
d55657bdf2 Added comments before recently added/assigned slots in the type object,
so the backward compatibility issues will be easier to understand.  I only
added comments indicating additions and assignments back to Python 2.0.
2001-08-15 18:32:33 +00:00
Guido van Rossum
88dcf03068 Add 'state' as a get/set attribute to spamlist. This serves as an
example.
2001-08-15 18:18:58 +00:00
Guido van Rossum
e6b90eaea1 Add 'state' as a read-only attribute to spamdict. This serves as an
example.
2001-08-15 18:09:11 +00:00
Guido van Rossum
23cc2b4991 PyMethod_Type: add a tp_descr_get slot function to ensure proper
binding of unbound methods.
2001-08-15 17:52:31 +00:00
Guido van Rossum
b5a136b05d Add a test to verify that bound methods work correctly. 2001-08-15 17:51:17 +00:00
Martin v. Löwis
f95dd0a298 Fix portability problems with glibc 2.0, as reported in #449157. 2001-08-15 17:14:33 +00:00
Fred Drake
834a85a235 Use the "howto" document class rather than the "manual" class.
Remove the module index; there aren't enough modules documented yet
for this to make sense.

Add a couple more index entries, fixed a few typos, and adjusted a few
more things for consistency.
2001-08-15 17:01:34 +00:00
Fred Drake
27413a5eda Properly mark attribute names in the table. 2001-08-15 16:47:10 +00:00
Fred Drake
3d05161c83 Change the generated markup so that attribute names are properly marked. 2001-08-15 16:46:22 +00:00
Fred Drake
13130bc5b1 Use the abstract object interfaces when digging around in module objects
instead of directly manipulating the underlying dictionary.
2001-08-15 16:44:56 +00:00
Andrew M. Kuchling
94a7eba9db Note addition of cleanfuture.py 2001-08-15 15:55:48 +00:00
Andrew M. Kuchling
b053209af7 Fix typo 2001-08-15 15:54:56 +00:00
Fred Drake
42caf3f6a3 Fix small markup consistency nits. 2001-08-15 14:35:13 +00:00
Jack Jansen
591cbede56 MacOSX: if we're building without --enable-toolbox-glue don't attempt to
include _PyMac_Error. Also don't try to include __dummy: it needs Foundation
and I think (not 100% sure) that this isn't part of naked Darwin.
2001-08-15 13:55:15 +00:00
Jack Jansen
df82e58cd5 On OSX we should not pass the -shared option to ld: it make the build
of audioop and cmath fail. Removing it seems to have no adverse consequences.

Closes bug #450510.
2001-08-15 13:17:45 +00:00
Jack Jansen
31b5323c84 Don't remove non-directories from sys.path on the mac: files
can be on sys.path too.
2001-08-15 12:07:46 +00:00
Tim Peters
591f71b1d4 New, larger installer bitmap from Erik van Blokland. Added more
vertical whitespace to the acknowledgements portion of the "Installation
Completed!" screen for easier reading.
2001-08-15 06:10:16 +00:00
Tim Peters
ebb7133f4f Fix typo in module docstring. 2001-08-15 06:07:42 +00:00
Tim Peters
0afb60951d Add blurb about cleanfuture.py. Fix misspelling in an older item. 2001-08-15 06:06:44 +00:00
Tim Peters
e5614630fb Move one of the tests into the "PEP 255" section, to reflect a change in
the PEP.
2001-08-15 04:41:19 +00:00
Jack Jansen
e578a63827 Oops, forgot to check in configure. 2001-08-15 01:27:14 +00:00
Jack Jansen
b6e9cad34c Lots of changes in the framework support:
- Made framework builds work for MacOSX. The configure arg is now
  "--enable-framework".
- Added an install target frameworkinstall which installs the framework.
- Ripped out Next/OpenStep support, which was broken anyway.
- Made the MacOSX toolbox glue dependant on a --enable-toolbox-glue
  configure arg. This should make naked darwin build work again (untested).

A few targets have been added to Makefile.pre.in, and on inspection they
look harmless to non-MacOSX machines, but it is worth checking.

Closes bug #420601 and patch #450350.
2001-08-15 01:26:28 +00:00
Jack Jansen
e925faff8e With WITH_NEXT_FRAMEWORK defined we now also expect a normal Python
installation.
If there is no LANDMARK we assume we're a bare framework in the
install directory (again WITH_NEXT_FRAMEWORK only).
2001-08-15 01:14:40 +00:00
Jeremy Hylton
f5bf77c3f8 update simple explanation of parseFile() 2001-08-14 22:38:03 +00:00
Jeremy Hylton
76f42ac512 First day's progress on documentation 2001-08-14 22:04:44 +00:00
Fred Drake
ce575bac5e Fix a minor typo and mark an exception name that was missed. 2001-08-14 21:51:50 +00:00
Fred Drake
c0cf726d8c Add material about the "r" and "u" prefixes for string literals; should
be reviewed for clarity.

Work around a bogosity in the HTML version of the escape sequences table
conversion.
2001-08-14 21:43:31 +00:00
Fred Drake
0cac5f697b Added some examples of table markup. 2001-08-14 21:36:19 +00:00
Jeremy Hylton
9272b14d62 Fix typo in astgen script 2001-08-14 21:18:30 +00:00
Fred Drake
3e2aca48bd Add information about __floordiv__() and __truediv__() methods for
implementing numeric objects in Python.
2001-08-14 20:28:08 +00:00
Guido van Rossum
4dd64ab5ea Non-function fields, like tp_dictoffset and tp_weaklistoffset, should
be inherited in inherit_special(), otherwise dynamic types don't
inherit these.

Also added some XXX comments about open ends.
2001-08-14 20:04:48 +00:00
Jeremy Hylton
481081e369 Fix SF bug [ #450909 ] __future__.division fails at prompt
When code is compiled and compiler flags are passed in, be sure to
update cf_flags with any features defined by future statements in the
compiled code.
2001-08-14 20:01:59 +00:00
Guido van Rossum
80e36750c8 Add a test for a weird bug I just discovered: a dynamic subclass
doesn't have a __dict__!
2001-08-14 20:00:33 +00:00
Fred Drake
d3ba10f4b5 Clarify the prompt in an example.
This closes SF bug #450633.
2001-08-14 19:55:42 +00:00
Jeremy Hylton
7713ac2ff1 Regenerated from new ast.txt and new astgen.py 2001-08-14 18:59:01 +00:00
Jeremy Hylton
eef65908a1 Add getChildNodes() method to Node 2001-08-14 18:58:00 +00:00
Jeremy Hylton
34aeeffb62 Add Yield node 2001-08-14 18:57:43 +00:00
Barry Warsaw
9b3be7f5d9 Document the new semantics for setting and deleting a function's
__dict__ attribute.  Deleting it, or setting it to a non-dictionary
result in a TypeError.  Note that getting it the first time magically
initializes it to an empty dict so that func.__dict__ will always
appear to be a dictionary (never None).

Closes SF bug #446645.
2001-08-14 18:35:02 +00:00
Barry Warsaw
033daa49ea Test the new semantics for setting and deleting a function's __dict__
attribute.  Deleting it, or setting it to a non-dictionary result in a
TypeError.  Note that getting it the first time magically initializes
it to an empty dict so that func.__dict__ will always appear to be a
dictionary (never None).

Closes SF bug #446645.
2001-08-14 18:28:28 +00:00
Barry Warsaw
142865cae1 func_getattro(), func_setattro(): Implement the new semantics for
setting and deleting a function's __dict__ attribute.  Deleting
    it, or setting it to a non-dictionary result in a TypeError.  Note
    that getting it the first time magically initializes it to an
    empty dict so that func.__dict__ will always appear to be a
    dictionary (never None).

    Closes SF bug #446645.
2001-08-14 18:23:58 +00:00
Barry Warsaw
5ef99a0bc5 Describe the new semantics for setting and deleting a function's
__dict__ attribute.  Deleting it, or setting it to a non-dictionary
result in a TypeError.  Note that getting it the first time magically
initializes it to an empty dict so that func.__dict__ will always
appear to be a dictionary (never None).

Closes SF bug #446645.
2001-08-14 18:22:24 +00:00
Fred Drake
680cabb225 Add "exceptions" to the list of fundamental modules
created by Py_Initialize().

This closes SF bug #450621.
2001-08-14 15:32:16 +00:00
Fred Drake
280f7253e4 Insert omitted "the". 2001-08-14 11:42:13 +00:00
Fred Drake
bf781a95c0 Add the smtpd module to the list of undocumented modules; Barry needs to
write the documentation for this module.
2001-08-14 11:38:35 +00:00