Commit Graph

20560 Commits

Author SHA1 Message Date
Barry Warsaw 856c32b5f4 Another merge from mimelib:
_handle_multipart(): If there is an epilogue and the epilogue does
    not itself start with a newline, add a newline before writing the
    epilogue.  Closes SF bug #472481.
2001-10-19 04:06:39 +00:00
Jeremy Hylton cb4414366b Add entry for RAND_xxx() functions in socket module. 2001-10-19 03:40:19 +00:00
Guido van Rossum 1c486099ad Note the Unicode changes from SF patch #470578. 2001-10-19 02:05:35 +00:00
Guido van Rossum b8c65bc27f SF patch #470578: Fixes to synchronize unicode() and str()
This patch implements what we have discussed on python-dev late in
    September: str(obj) and unicode(obj) should behave similar, while
    the old behaviour is retained for unicode(obj, encoding, errors).

    The patch also adds a new feature with which objects can provide
    unicode(obj) with input data: the __unicode__ method. Currently no
    new tp_unicode slot is implemented; this is left as option for the
    future.

    Note that PyUnicode_FromEncodedObject() no longer accepts Unicode
    objects as input. The API name already suggests that Unicode
    objects do not belong in the list of acceptable objects and the
    functionality was only needed because
    PyUnicode_FromEncodedObject() was being used directly by
    unicode(). The latter was changed in the discussed way:

    * unicode(obj) calls PyObject_Unicode()
    * unicode(obj, encoding, errors) calls PyUnicode_FromEncodedObject()

    One thing left open to discussion is whether to leave the
    PyUnicode_FromObject() API as a thin API extension on top of
    PyUnicode_FromEncodedObject() or to turn it into a (macro) alias
    for PyObject_Unicode() and deprecate it. Doing so would have some
    surprising consequences though, e.g.  u"abc" + 123 would turn out
    as u"abc123"...

[Marc-Andre didn't have time to check this in before the deadline.  I
hope this is OK, Marc-Andre!  You can still make changes and commit
them on the trunk after the branch has been made, but then please mail
Barry a context diff if you want the change to be merged into the
2.2b1 release branch.  GvR]
2001-10-19 02:01:31 +00:00
Guido van Rossum 93505a2f2b Another. 2001-10-19 01:51:11 +00:00
Guido van Rossum b8cf3e64be SF patch #470393 (Jim Ahlstrom): Add missing marshal function
In Include/, marshal.h declares both
    PyMarshal_ReadLongFromFile()
    and PyMarshal_ReadShortFromFile(),
    but the second is missing from marshal.c.

[Shouldn't the return type be declared as 'short' instead of 'int'?
But 'int' is what was in marshal.h all those years...  --Guido]
2001-10-19 01:46:21 +00:00
Guido van Rossum c524d952da SF patch #460805 by Chris Gonnerman: Support for unsetenv()
This adds unsetenv to posix, and uses it in the __delitem__ method of
os.environ.

(XXX Should we change the preferred name for putenv to setenv, for
consistency?)
2001-10-19 01:31:59 +00:00
Guido van Rossum b6c1d5239c SF patch #443759: Add Interface to readline's add_history
This was submitted by Moshe, but apparently he's too busy to check it
in himself.  He wrote:

    Here is a function in GNU readline called add_history,
    which is used to manage the history list. Though Python
    uses this function internally, it does not expose it to
    the Python programmer. This patch adds direct interface
    to this function with documentation.

    This could be used by friendly modules to "seed" the
    history with commands.
2001-10-19 01:18:43 +00:00
Martin v. Löwis a660a34844 Assume a 64-bit start and len if O_LARGEFILE is available. 2001-10-18 22:07:48 +00:00
Martin v. Löwis 4fe3c27323 Expose O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW. 2001-10-18 22:05:36 +00:00
Tim Peters e0c446bb4a Whitespace normalization. 2001-10-18 21:57:37 +00:00
Martin v. Löwis 8a57f00081 Move dlfcn.h block out of NetBSD block, assuming that NetBSD before
199712 didn't have dlfcn.h, or that it wouldn't conflict with the other
stuff defined.
2001-10-18 21:24:04 +00:00
Guido van Rossum 1fff878c45 The assignment to result.st_rdev can raise AttributeError as well as
TypeError (on systems where it's not defined at all, it raises
AttributeError; when it's defined, assignment to it raises TypeError).
2001-10-18 21:19:31 +00:00
Fredrik Lundh a5e616510e changed misleading argument name 2001-10-18 20:58:25 +00:00
Guido van Rossum a4dc73e246 Don't leave bare newlines in long strings -- VC doesn't like that. 2001-10-18 20:53:15 +00:00
Guido van Rossum d6f8dba217 add structseq.c to project 2001-10-18 20:51:32 +00:00
Tim Peters 6e6a63f01c SF Patch (but with no patch) 472555 Remove trailing common in enumeration.
Some AIX compiler didn't like the trailing comma at the end of the
why_code enum decl.
2001-10-18 20:49:35 +00:00
Guido van Rossum e82f75aa20 Missing file structseq.c for SF patch #462296 2001-10-18 20:47:51 +00:00
Guido van Rossum 98bf58f1c6 SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
Tim Peters 8dd7adeb34 SF bug [#472347] pydoc and properties.
The GUI-mode code to display properties blew up if the property functions
(get, set, etc) weren't simply methods (or functions).

"The problem" here is really that the generic document() method dispatches
to one of .doc{routine, class, module, other}(), but all of those require
a different(!) number of arguments.  Thus document isn't general-purpose
at all:  you have to know exactly what kind of thing is it you're going
to document first, in order to pass the correct number of arguments to
.document for it to pass on.  As an expedient hack, just tacked "*ignored"
on to the end of the formal argument lists for the .docXXX routines so
that .document's caller doesn't have to know in advance which path
.document is going to take.
2001-10-18 19:56:17 +00:00
Guido van Rossum a6535fd40b Shut up warnings for setgroups() on Linux -- you have to #include
<grp.h> it seems.  This requires yet another configure test.
2001-10-18 19:44:10 +00:00
Barry Warsaw 91b81c4802 Some minor clarifications for find()'s arguments based on SF bug
#463572.  Closing.
2001-10-18 19:41:48 +00:00
Fred Drake c10039c011 Do not expect line number events when running under "python -O".
The right fix is to generate line number events anyway ;-), but this will
have to do for now.
2001-10-18 19:34:00 +00:00
Fredrik Lundh 397a654791 SRE bug #441409:
compile should raise error for non-strings
SRE bug #432570, 448951:
    reset group after failed match

also bumped version number to 2.2.0
2001-10-18 19:30:16 +00:00
Fred Drake 3bb4d214a4 Add a test for calling a weakref proxy with a dictionary of keyword args. 2001-10-18 19:28:29 +00:00
Fred Drake 31f4d1fa4b Remove an unnecessary check for NULL. 2001-10-18 19:21:46 +00:00
Guido van Rossum 6c4bce3b5c Note stricter tp_compare return value requirements. 2001-10-18 19:20:25 +00:00
Guido van Rossum 03f7f08874 Part 2/2 of SF patch #416704: More robust freeze, by Toby Dickenson.
(With slight cosmetic improvements to shorten lines and a grammar fix
to a docstring.)

This addes -X and -E options to freeze.  From the docstring:

-X module     Like -x, except the module can never be imported by
              the frozen binary.

-E:           Freeze will fail if any modules can't be found (that
              were not excluded using -x or -X).
2001-10-18 19:15:32 +00:00
Fred Drake db7287c0f5 Straighten out the exec*() function descriptions a bit, and clarify a few
points in the spawn*() description.
2001-10-18 18:58:30 +00:00
Tim Peters 84a0657ee9 Squash compiler wng about signed/unsigned mismatch. 2001-10-18 18:57:31 +00:00
Guido van Rossum 8f4d3316de First part of SF patch #416704: More robust freeze, by Toby Dickenson.
This fixes the behavior reported by SF bug #404545, where a file
x.y.py could be imported by the statement "import x.y" when there's a
frozen package x (I believe even if x.y also exists as a frozen
module).
2001-10-18 18:54:11 +00:00
Guido van Rossum 4114a4afec Fix the frozen bytecode for __hello__ (betcha didn't know that existed
:-).

Add a test that prevents the __hello__ bytecode from going stale
unnoticed again.

The test also tests the loophole noted in SF bug #404545.  This test
will fail right now; I'll check in the fix in a minute.
2001-10-18 18:49:37 +00:00
Fred Drake 9ae09947f4 Bump version number.
Remove inconsistent use of HTMLDIR.
2001-10-18 18:46:22 +00:00
Fred Drake 77165d039f Bump release information. 2001-10-18 18:41:12 +00:00
Fred Drake 934d2a4310 Add a note about changes related to the weak reference objects. 2001-10-18 18:18:06 +00:00
Fred Drake 39c27f1ffb Make sure we do not core dump when using proxies with the binary slot
handlers.  This was fixed in Objects/weakrefobject.c 1.2.
2001-10-18 18:06:05 +00:00
Fred Drake 73006d0237 When weakref proxies are involved in binary & ternary slot operations,
the left-hand operand may not be the proxy in all cases.  If it isn't,
we end up doing two things: a) unwrapping something that isn't a
PyWeakReference (later resulting in a core dump) and b) passing a
proxy as the right-hand operand anyway, even though that can't be
handled by the actual handler (maybe eventually causing a core dump).

This is fixed by always unwrapping all the proxies involved before
passing anything to the actual handler.
2001-10-18 18:04:18 +00:00
Guido van Rossum a5343ccd28 SF bug #471720: ThreadingMixIn/TCPServer forgets close
Solved with a helper method that calls finish_request() and then
close_request().  The code is by Max Neunhöffer.
2001-10-18 18:02:07 +00:00
Martin v. Löwis 29103c7b32 Reindent __repr__. 2001-10-18 17:33:19 +00:00
Jeremy Hylton cf672f15e0 Add test for local assigned to only in a nested list comp 2001-10-18 16:23:11 +00:00
Jeremy Hylton 961dfe0d85 Fix for SF bug [ #471928 ] global made w/nested list comprehensions
The symbol table pass didn't have an explicit case for the list_iter
node which is used only for a nested list comprehension.  As a result,
the target of the list comprehension was treated as a use instead of
an assignment.  Fix is to add a case to symtable_node() to handle
list_iter.

Also, rework and document a couple of the subtler implementation
issues in the symbol table pass.  The symtable_node() switch statement
depends on falling through the last several cases, in order to handle
some of the more complicated nodes like atom.  Add a comment
explaining the behavior before the first fall through case.  Add a
comment /* fall through */ at the end of case so that it is explicitly
marked as such.

Move the for_stmt case out of the fall through logic, which simplifies
both for_stmt and default.  (The default used the local variable start
to skip the first three nodes of a for_stmt when it fell through.)

Rename the flag argument to symtable_assign() to def_flag and add a
comment explaining its use:

   The third argument to symatble_assign() is a flag to be passed to
   symtable_add_def() if it is eventually called.  The flag is useful
   to specify the particular type of assignment that should be
   recorded, e.g. an assignment caused by import.
2001-10-18 16:15:10 +00:00
Guido van Rossum f76de62f7d Fix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink)
The fix is a band-aid: type_call() now makes the same exception for a
single-argument call to type() as type_new() was already making.
2001-10-18 15:49:21 +00:00
Martin v. Löwis b7da67a873 Use CXX in LINKCC if CXX is used to build main() and the system requires
to link a C++ main using the C++ compiler. Fixes #472007.
2001-10-18 15:35:38 +00:00
Fred Drake 316141b333 Fix typo reported by Michael Soulier. 2001-10-18 15:22:23 +00:00
Tim Peters 5a9d16b90f Bump Windows build # for 2.2b1. 2001-10-18 15:19:38 +00:00
Fred Drake ca836f7e65 Function descriptions must end as well as start! 2001-10-18 14:26:08 +00:00
Martin v. Löwis c405133fce Elaborate on types and meaning of the setgroups arguments. 2001-10-18 14:07:12 +00:00
Martin v. Löwis 0eb1ed556b Patch to bug #472202: Correctly recognize NetBSD before 199712. 2001-10-18 11:45:19 +00:00
Martin v. Löwis eee80ee2ef Patch #470744: Simplify __repr__ error handling. 2001-10-18 11:39:34 +00:00
Martin v. Löwis 61c5edf6fc Expose setgroups. Fixes feature request #468116. 2001-10-18 04:06:00 +00:00