Commit Graph

2963 Commits

Author SHA1 Message Date
Guido van Rossum e276339cea Implement an idea by Paul Rubin:
Change pickling format for bools to use a backwards compatible
encoding.  This means you can pickle True or False on Python 2.3
and Python 2.2 or before will read it back as 1 or 0.  The code
used for pickling bools before would create pickles that could
not be read in previous Python versions.
2002-04-05 19:30:08 +00:00
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Guido van Rossum 2e1c09c1fd Removed old Digital Creations copyright/license notices (with
permission from Paul Everitt).  Also removed a few other references to
Digital Creations and changed the remaining ones to Zope Corporation.
2002-04-04 17:52:50 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285.  Everything described in the PEP is here, and there is even
some documentation.  I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison.  I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.

Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
2002-04-03 22:41:51 +00:00
Fred Drake a2bd8d3816 Remove direct manipulation of the module dict. 2002-04-03 21:39:26 +00:00
Mark Hammond e7fefbf68d Fix bugs:
457466: popenx() argument mangling hangs python
 226766: popen('python -c"...."') tends to hang

Fixes argument quoting in w9xpopen.exe for Windows 9x.  w9xpopen.exe
also never attempts to display a MessageBox when not executed
interactively.

Added test_popen() test.  This test currently just executes
"python -c ..." as a child process, and checks that the expected
arguments were all recieved correctly by the child process.  This
test succeeds for me on Win9x, win2k and Linux, and I hope it does
for other popen supported platforms too :)
2002-04-03 01:47:00 +00:00
Neal Norwitz b0aaec5706 Convert more METH_OLDARGS & PyArg_Parse()
Please review.
2002-04-02 18:26:33 +00:00
Neal Norwitz 187ae56166 Get rid of more PyArg_Parse & METH_OLDARGS.
PyArg_Parse( "s" )  -> PyString_AsString
  PyArg_Parse( "t#" ) -> PyString_AsStringAndSize
2002-04-02 18:17:57 +00:00
Martin v. Löwis 2f6ef4c630 Reindent. Break long lines. Move comments before the statements. 2002-04-01 17:40:08 +00:00
Fred Drake 4baedc1d9b Use the PyModule_Add*() APIs instead of manipulating the module dict
directly.
2002-04-01 14:53:37 +00:00
Fred Drake 9bb7432114 Remove all but one use of the module dict. 2002-04-01 14:49:59 +00:00
Fred Drake d63e504d33 Remove unused variable and call to PyModule_GetDict(). 2002-04-01 14:30:50 +00:00
Fred Drake acee69faf8 Switch to using METH_NOARGS where possible.
Convert to use PyModule_*() instead of manipulating the module dict directly.
2002-04-01 14:28:58 +00:00
Martin v. Löwis 43c9d8ad23 Remove UNLESS. 2002-04-01 12:34:33 +00:00
Fred Drake f4e3484692 Use the PyModule_*() API instead of manipulating the module dictionary
directly.
2002-04-01 03:45:06 +00:00
Neal Norwitz 02098fa56b Get rid of all METH_OLDARGS & PyArg_Parse.
Fix floating point exception if mpz.powm(10, 1, 0) (modulus == 0).
Add a test.
2002-04-01 01:37:14 +00:00
Neal Norwitz dfd59e039a mpz_float() only takes one parameter now 2002-03-31 22:02:37 +00:00
Neal Norwitz 767f83539d Get rid of warnings due to changing to METH_NOARGS 2002-03-31 16:13:39 +00:00
Neal Norwitz 28faa1bf28 Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Use METH_OLDARGS explicitly rather than implicitly.
2002-03-31 15:56:56 +00:00
Neal Norwitz bb2769f580 Revert use of METH_OLDARGS (use 0) to support 1.5.2 2002-03-31 15:46:00 +00:00
Neal Norwitz b82d34f91e Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
Please review for correctness.
2002-03-31 15:43:28 +00:00
Neal Norwitz ba3a16c6c3 Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
  Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Please review.  All tests pass, but some modules don't have tests.
I spot checked various functions to try to make sure nothing broke.
2002-03-31 15:27:00 +00:00
Neal Norwitz 50905b557b Convert from using METH_OLDARGS to METH_NOARGS.
These should be safe.
2002-03-31 14:57:24 +00:00
Neal Norwitz 01b2694acb Fix whitespace 2002-03-31 14:55:17 +00:00
Neal Norwitz b049325e92 Use symbolic METH_VARARGS/METH_OLDARGS instead of 1/0 for ml_flags 2002-03-31 14:44:22 +00:00
Neil Schemenauer cc07ec17a3 Add missing typecast. 2002-03-29 19:58:25 +00:00
Andrew M. Kuchling f4a4fb9a11 [Patch #536769] Add -Xcompiler flag for adding arguments and switches for
the compiler
2002-03-29 18:00:19 +00:00
Neil Schemenauer b883310d59 Make _PyObject_GC_UnTrack do nothing if WITH_CYCLE_GC is not defined. 2002-03-29 03:04:25 +00:00
Neil Schemenauer 78662cf9a1 Add type cast. 2002-03-28 21:04:14 +00:00
Guido van Rossum ff413af605 This is Neil's fix for SF bug 535905 (Evil Trashcan and GC interaction).
The fix makes it possible to call PyObject_GC_UnTrack() more than once
on the same object, and then move the PyObject_GC_UnTrack() call to
*before* the trashcan code is invoked.

BUGFIX CANDIDATE!
2002-03-28 20:34:59 +00:00
Fred Drake f841aa6fc0 Add a simple test of the METH_CLASS and METH_STATIC flags for type methods. 2002-03-28 15:49:54 +00:00
Martin v. Löwis 2e64c34850 Expose C library's gettext. Fixes #516412. 2002-03-27 18:49:02 +00:00
Martin v. Löwis 496f9e41ef Don't imply XPG4 constants from CODESET presence. Fixes #534153.
2.2.2 candiate.
2002-03-27 12:15:57 +00:00
Neal Norwitz 4632117e37 Missed change METH_OLDARGS to METH_NOARGS for two aliased functions 2002-03-26 14:52:00 +00:00
Neal Norwitz 7e78acbb1b Remove last occurrance of PyArg_GetInt. It is deprecated, 2002-03-25 22:23:53 +00:00
Neal Norwitz 2358425146 Missed change METH_OLDARGS to METH_NOARGS for two aliased functions 2002-03-25 21:05:50 +00:00
Neal Norwitz 3a6f97850b Remove many uses of PyArg_NoArgs macro, change METH_OLDARGS to METH_NOARGS. 2002-03-25 20:46:46 +00:00
Jack Jansen 6d8898b5eb Due to interaction between the MSL C library and the GUSI I/O library I can get reads from sockets to work consistently either for unbuffered binary files or for buffered binary files, but not for both:-(
The workaround is to force socket.makefile() to disable buffering for binary files.

Fixes bug 534625. 2.2.1 candidate.
2002-03-25 15:32:01 +00:00
Neil Schemenauer 29ac3cb7ed Expose RLIM_INFINITY constant. Closes SF patch 489066. 2002-03-24 22:27:39 +00:00
Neil Schemenauer 0f75e0dcad Add get_history_item, get_current_history_length, and redisplay functions.
Clarify the docstring for get_history_length.  Closes SF patch 494066.
2002-03-24 01:09:04 +00:00
Neil Schemenauer fa79c65235 Match behavior of the pickle.py module more closely. 2002-03-22 23:02:53 +00:00
Neil Schemenauer 94b866a030 Handle os.listdir("") case correctly on Windows. Closes bug 500705. 2002-03-22 20:51:58 +00:00
Neil Schemenauer 1b0e4fcc29 Use pymalloc for realloc() as well. 2002-03-22 15:41:03 +00:00
Neil Schemenauer dcc819a5c9 Use pymalloc if it's enabled. 2002-03-22 15:33:15 +00:00
Neal Norwitz 3afb2d2bba Remove compiler warnings on Solaris 8.
Can go into 2.2.x, but not necessary.
2002-03-20 21:32:07 +00:00
Neal Norwitz 5909402cde Remove extraneous #define as per effbot's instructions in:
[ 530285 ] redefining SRE_CODE in Modules/sre.h
2002-03-18 18:46:14 +00:00
Martin v. Löwis d4233b2b8c Include Python.h first. Fixes #530159. 2002-03-15 09:16:40 +00:00
Martin v. Löwis dc0b61d0b1 Verify arguments for nl_langinfo. Fixes #528879. 2002-03-12 22:05:02 +00:00
Fred Drake 1de5a722d6 Change the example code to prefer PyModule_Add*() instead of using the
module dictionary directly.  Also, be more careful about not re-initializing
globals in the event of re-initialization of a C extension.
2002-03-12 21:49:44 +00:00
Fred Drake 193a3f6d37 Update docstrings to use te attribute names of the new structures returned
by stat and time functions.
This closes SF patch #523271.
2002-03-12 21:38:49 +00:00
Sjoerd Mullender 556a938d10 Changed C++ comment into standard comment. 2002-03-11 09:20:47 +00:00
Tim Peters dc5a508761 SF bug 525705: [2.2] underflow raise OverflowException.
Another year in the quest to out-guess random C behavior.

Added macros Py_ADJUST_ERANGE1(X) and Py_ADJUST_ERANGE2(X, Y).  The latter
is useful for functions with complex results.  Two corrections to errno-
after-libm-call are attempted:

1. If the platform set errno to ERANGE due to underflow, clear errno.
   Some unknown subset of libm versions and link options do this.  It's
   allowed by C89, but I never figured anyone would do it.

2. If the platform did not set errno but overflow occurred, force
   errno to ERANGE.  C89 required setting errno to ERANGE, but C99
   doesn't.  Some unknown subset of libm versions and link options do
   it the C99 way now.

Bugfix candidate, but hold off until some Linux people actually try it,
with and without -lieee.  I'll send a help plea to Python-Dev.
2002-03-09 04:58:24 +00:00
Jeremy Hylton b189b07dcc Fix SF bug #526518
The doc string for cStringIO suggested that str() of a StringIO object
was equivalent to getvalue().  This was never true, so repair the doc
string.  (doctest would have helped here.)

Bug fix candidate for any past versions.
2002-03-08 17:17:33 +00:00
Tim Peters c9ffa068d1 SF bug 515943: searching for data with \0 in mmap.
mmap_find_method():  this obtained the string to find via s#, but it
ignored its length, acting as if it were \0-terminated instead.

Someone please run on Linux too (the extended test_mmap works on Windows).

Bugfix candidate.
2002-03-08 05:43:32 +00:00
Martin v. Löwis aa158be623 Remove tp_print. 2002-03-04 09:38:52 +00:00
Tim Peters bc2e10e7b6 Python no longer compiled on Windows, due to #include file confusion
over SEP, ALTSEP and MAXPATHLEN.
Patched up posixmodule.c for MSVC, but unsure what the story is now on
other non-Unixish platforms -- the preprocessor maze has no exit <wink>.
2002-03-03 23:17:02 +00:00
Andrew MacIntyre 6c73af2754 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    posixmodule.c

- use SEP,ALTSEP #defines instead of hard coded path separator chars
- use EMX specific variants of chdir2(),getcwd() that support drive letters
- OS/2+EMX spawnv(),spawnve() support
- EMX specific popen[234]() derived from Win32 popen[234]() code
2002-03-03 03:07:07 +00:00
Andrew MacIntyre ba43e8700b OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    socketmodule.c

EMX handles sockets like Posix, rather than use native APIs
2002-03-03 03:03:52 +00:00
Andrew MacIntyre 7bf6833e17 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    _hotshot.c
    dbmmodule.c
    fcntlmodule.c
    main.c
    pwdmodule.c
    readline.c
    selectmodule.c
    signalmodule.c
    termios.c
    timemodule.c
    unicodedata.c
2002-03-03 02:59:16 +00:00
Guido van Rossum 6f33250ef9 SF patch 517245 by Marc Recht.
Support GMP version >= 2.

Bugfix candidate.
2002-03-01 21:31:27 +00:00
Martin v. Löwis dbd55b3737 Patch #523268, #522027: return enhanced tuples. 2002-03-01 10:38:44 +00:00
Martin v. Löwis 9986633609 Patch 520694: arraymodule.c improvements:
- make array.array a type
- add Py_UNICODE arrays
- support +=, *=
2002-03-01 10:27:01 +00:00
Martin v. Löwis 272cb40e31 Patch #520062: Support IPv6 with VC.NET. 2002-03-01 08:31:07 +00:00
Marc-André Lemburg 666e70de25 Add documentation about how the inter-module linking works. 2002-02-25 14:45:40 +00:00
Tim Peters 643a7fc62f Moved the declaration of PySocketSock_Type from socketmodule.h to
socketmodule.c.  No code outside of the .c file references it, so it
doesn't belong the .h file (at least not yet ...), and declaring it
an imported symbol in the .h file can't be made to work on Windows (it's
a cross-DLL symbol then) without substantial code rewriting.  Also
repaired the comment that goes along with the decl, to stop referring
to names and functions that haven't existed for 7 years <wink>.

socketmodule.c compiles cleanly on Windows again.  The test_socket dies
at once, though (later).
2002-02-17 04:13:21 +00:00
Tim Peters 6f5505aaf9 For readability, switch to tab indents; was using a mix of tab indents,
4-space indents, and ambiguous space+tab indents.  Added an XXX comment
about a confusing part.  Still doesn't build on Windows.
2002-02-17 03:58:51 +00:00
Martin v. Löwis b2c92f44d4 Patch #511193: Implement killpg in posixmodule. 2002-02-16 23:35:41 +00:00
Martin v. Löwis e6cc5b68bf Remove extraneous variable 'total', as reported by James Rucker. 2002-02-16 23:13:54 +00:00
Marc-André Lemburg 976ade691c Also fix the comment. 2002-02-16 18:47:07 +00:00
Marc-André Lemburg bb8b78b77a Fix the name of the header file. 2002-02-16 18:44:52 +00:00
Marc-André Lemburg a5d2b4cb18 Break SSL support out of _socket module and place it into a new
helper module _ssl.

The support for the RAND_* APIs in _ssl is now only enabled
for OpenSSL 0.9.5 and up since they were added in that
release.

Note that socketmodule.* should really be renamed to _socket.* --
unfortunately, this seems to lose the CVS history of the file.

Please review and test... I was only able to test the header file
chaos in socketmodule.c/h on Linux. The test run through fine
and compiles don't give errors or warnings.

WARNING: This patch does *not* include changes to the various
non-Unix build process files.
2002-02-16 18:23:30 +00:00
Fred Drake 2eeec9bde5 Fix typo. 2002-02-14 07:16:30 +00:00
Fred Drake 78f6c867ae Use PyModule_AddObject() instead of accessing the module dict directly. 2002-02-14 07:11:23 +00:00
Fred Drake cca657b8fe Use PyModule_AddIntConstant() instead of creating a private helper function.
This also avoids directly accessing the module'd __dict__.
2002-02-14 06:59:26 +00:00
Michael W. Hudson 0c1ceaf66d Simon Budig's patch (posted by me):
[ #513235 ] prevent readline filename completion
2002-02-13 11:58:25 +00:00
Martin v. Löwis 8fef47be5f Define VERSION in expat.h. 2002-02-13 07:47:16 +00:00
Tim Peters 9ad4b688ec Windows time_clock(): rewrite to get rid of horrid casting tricks.
Don't blame Mark!  The horrid casting tricks were my idea to begin with.
The rewrite works fine under VC6, and I *expect* will work fine under VC7.
2002-02-13 05:14:18 +00:00
Martin v. Löwis b48d198c12 "Generate" from expat.h.in, for 1.95.2. 2002-02-12 09:52:22 +00:00
Mark Hammond 7ba5e810fd Ensure we also build on VC7. Involves replacing largeint.h helper functions with msvc's native 64 bit integers. 2002-02-12 04:02:33 +00:00
Martin v. Löwis cf453fe2a8 Use included Expat library. Drop support for older expat versions. 2002-02-11 23:27:45 +00:00
Martin v. Löwis 481f68aaa6 Disable usage of Expat's config.h. 2002-02-11 23:16:32 +00:00
Martin v. Löwis 1dbb1caf86 Initial revision 2002-02-11 23:13:04 +00:00
Marc-André Lemburg aeff6687b5 Remove mentioning of -U option in "python -h" output. 2002-02-11 18:46:47 +00:00
Fred Drake 2c146bfa28 start() and stop() methods: return None where there is no exception;
returning NULL causes the interpreter to raise a SystemError.
Noted by Anthony Baxter at Python 10.
2002-02-08 21:27:50 +00:00
Jack Jansen 4892f2406f Got rid of a few more NeXT ifdefs. The last, I think. 2002-02-01 15:46:29 +00:00
Tim Peters ab034fab03 Implement os.waitpid() for Windows, in a way that's compatible with Linux
where their capabilities intersect.  Would be nice if people using non-
MSVC compilers (Borland etc) took a whack at doing something similar for
them (this code relies on the MS _cwait function).
2002-02-01 11:27:43 +00:00
Michael W. Hudson cf6bfe49b1 Oh look, another one.
2.2.1 candiate (he says, largely talking to himself :)
2002-01-30 15:47:34 +00:00
Michael W. Hudson 67fb0c3705 I think this fixes
[ #510644 ] test_curses segfaults

If we use the *object* *allocator*, we should use the *object* *deallocator*,
not the *raw memory* deallocator (confused yet?).

I think this was what caused segfaults when pymalloc was enabled.

Even if it wasn't the cause, it's still wrong.

2.2.1 candidate.
2002-01-30 15:39:28 +00:00
Tim Peters 5aa916029d Expose more MS WIndows constants usable w/ low-level os.open(). 2002-01-30 05:46:57 +00:00
Neal Norwitz 2a47c0fa23 Fix spelling mistakes. Bugfix candidates. 2002-01-29 00:53:41 +00:00
Martin v. Löwis 84432eb4c0 Encode Unicode arguments to split/splitlist as UTF-8. Fixes #507962.
2.2.1 bugfix candidate.
2002-01-26 20:21:50 +00:00
Tim Peters 902952b910 Removed an XXX question (the answer is "yes" <wink>). 2002-01-26 17:58:02 +00:00
Martin v. Löwis 43b936d08c Patch #477750: Use METH_ constants in Modules. 2002-01-17 23:15:58 +00:00
Martin v. Löwis c0e1671c71 Patch #477752: Drop old-style getargs from curses. 2002-01-17 23:08:27 +00:00
Michael W. Hudson 8f5146088a Change some spaces to tabs. I don't *think* that was me, but it
might have been...
2002-01-16 15:18:09 +00:00
Michael W. Hudson f24281251f Fix for
[ #504284 ] Last build problems on AIX

I'm ignoring the suggestion that this should be an autoconf test in the
interests of having a fix today.  Feel free to quibble.
2002-01-16 15:14:49 +00:00
Martin v. Löwis 02af964924 Patch #504225: add plan9 ifdef to timemodule floatsleep. 2002-01-16 11:04:06 +00:00
Guido van Rossum 4f3a62d9bc There's no need for typechecks on the second and third argument of
new.instancemethod() -- the instancemethod object is now a perfectly
general container.

This fixes SF bug ##503091 (Pedro Rodriquez): new.instancemethod fails
for new classes

This is a 2.2.1 candidate.
2002-01-15 19:21:05 +00:00
Martin v. Löwis 175af2574f Export SIGINFO. Fixes #502077. 2002-01-12 11:43:25 +00:00
Martin v. Löwis cdc4451222 Include <unistd.h> in Python.h. Fixes #500924. 2002-01-12 11:05:12 +00:00
Marc-André Lemburg 3e3eacb5fc Fixed "u#" parser marker to pass through Unicode objects as-is without
going through the buffer interface API.

Added tests for this to the _testcapi module and updated docs.
2002-01-09 16:21:27 +00:00
Martin v. Löwis 93227275dc Patch #497126: Always compile dl. 2002-01-01 20:18:30 +00:00
Martin v. Löwis 1baeba6839 Add fcntl.h constants from glibc 2.2.4. Fixes #496171. 2001-12-28 21:08:12 +00:00
Guido van Rossum bb2501f638 Due to a cut-and-paste error, the type object exported under the name
statvfs_result was in fact the stat_result type object. :-(

2.2.1 bugfix!
2001-12-27 16:23:28 +00:00
Martin v. Löwis 3cde2cb78a Add TCP socket options from glibc 2.2.4. Fixes #495680.
2.2.1 bugfix candidate.
2001-12-22 15:05:32 +00:00
Barry Warsaw 52acb49298 Merge of the release22 branch changes back into the trunk. 2001-12-21 20:04:22 +00:00
Tim Peters 500bd035fa SF bug #495021: Crash calling os.stat with a trailing backslash
Patch from Mark Hammond, plus code rearrangement and comments from me.
posix_do_stat():  Windows-specific code could try to free() stack
memory in some cases when a path ending with a forward or backward slash
was passed to os.stat().
2001-12-19 19:05:01 +00:00
Guido van Rossum 950dce6f01 save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.

Objects that are instances of custom metaclasses, i.e. whose ob_type
is a subclass of PyType_Type, should be pickled the same as new-style
classes (objects whose ob_type is PyType_Type).  This can't be done
through the existing dispatch switches, and the __reduce__ trick
doesn't work for these, since it finds the unbound __reduce__ for
instances of the class (inherited from PyBaseObject_Type).  So check
explicitly using PyType_IsSubtype().
2001-12-19 16:56:54 +00:00
Tim Peters 1fbb577ee2 SF bug #494738: binascii_b2a_base64 overwrites memory.
binascii_b2a_base64():  We didn't allocate enough buffer space for very
short inputs (e.g., a 1-byte input can produce a 5-byte output, but we
only allocated 2 bytes).  I expect that malloc overheads absorbed the
overrun in practice, but computing a correct upper bound is a very simple
change.
2001-12-19 04:41:35 +00:00
Tim Peters 4befff95e9 initxxsubtype(): Add a comment to make the magic clearer; I doubt it's
obvious to anyone except PyType_Ready's author <0.9 wink>.
2001-12-17 18:26:19 +00:00
Guido van Rossum a7b9b3ccba Use PyType_Ready() for initialization of the ob_type field of our
types (the tp_base field must be initialized prior to that call).
2001-12-17 17:25:53 +00:00
Tim Peters dd5c05fe6d David Abrahams tried to compile this as a separate DLL under MSVC, and
got a barrage of compile errors that didn't make sense to the C++ brain:
MSVC does not allow C (but does allow C++) initializers to contain
data addresses supplied by other DLLs.  So changed the initializers here
to use dummy nulls, and changed module init to plug in the foreign
addresses at runtime (manually simulating what C++ does by magic).  Tested
on Windows, and Guido tested on Linux (thanks!).  BTW, the *point* is that
people are going to use this module as a template for writing their own
subtypes, and it's unusual for extension authors to build their extensions
into Python directly (separate DLLs are the norm on Windows); so it's
better if we give them a template that works <wink>.
2001-12-17 01:27:01 +00:00
Tim Peters 65760b2173 Give xxsubtype a module docstring, so its oddball purpose is discoverable
from a prompt without searching the source code (there was an SF bug
report about this, already closed ...  "479568 xxsubtype builtin").
2001-12-10 22:53:30 +00:00
Jack Jansen cb85244228 Mods by Tony Lownds (patch 490100, slightly massaged by me) to make Tkinter
work with Mac OS X Aqua-Tk, all nicely within ifdefs.

The process is not for the faint of heart, though: you need to download
and install the (alfa) Aqua-Tk, obtain a few needed X11 headers from
somewhere else and then everything builds. To run scripts using Tkinter
you must build with --enable-framework, build Python.app in Mac/OSX
and run your Tkinter scripts with that. Then, about half the tests in
Demo/tkinter work (or at least do something).

Checking this in anyway because it shouldn't break anything, and newer
versions of Aqua-Tk will streamline the process.
2001-12-09 23:15:56 +00:00
Fredrik Lundh 82b230732f bug #133283, #477728, #483789, #490573
backed out of broken minimal repeat patch from July

also fixed a couple of minor potential resource leaks in pattern_subx
(Guido had already fixed the big one)
2001-12-09 16:13:15 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.

This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this).  Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right.  Apologies if they're
not.  This also touches the weakref docs, which contains a sample type
object initializer.  It also touches the mmap test output, because the
mmap type's repr is included in that output.  It touches object.h to
put the correct description in a comment.
2001-12-08 18:02:58 +00:00
Guido van Rossum 7745218c05 SF patch #489989 (Charles G Waldman) linuxaudiodev.c - fix initialization
The OSS Programmer's Reference (www.4front-tech.com)
states:

*Setting Sampling Parameters

There are three parameters which affect the sound
quality (and therefore memory and bandwidth
requirements) of sampled audio data. These are:

** sample format (sometimes called number of bits)
** number of channels (mono or stereo), and
** sampling rate (speed)

NOTE:

It is important to always set these parameters in the
above order. Setting sampling rate before the number
of channels doesn't work with all devices.
2001-12-08 17:13:45 +00:00
Tim Peters 25059d30c3 SF patch #489173: Make os.spawnv not block the interpreter, from
Anthony Roach.
Release the global interpreter lock around platform spawn calls.
Bugfix candidate?  Hard to say; I favor "yes, bugfix".
These clearly *should* have been releasing the GIL all along, if for no
other reason than compatibility with the similar os.system().  But it's
possible some program out there is (a) multithreaded, (b) calling a spawn
function with P_WAIT, and (c) relying on the spawn call to block all their
threads until the spawned program completes.  I think it's very unlikely
anyone is doing that on purpose, but someone may be doing so by accident.
2001-12-07 20:35:43 +00:00
Guido van Rossum 2f09812efa O_cwrite(): rewrote for clarity, replacing all the (Oobject *)self
casts with a variable oself that has the proper type.  A smart
compiler may put this thing into a register.

(I'm not sure what good this does except satisfy my desire to
understand this function; I got a report about an uninitialized read
from Insure++ about this function and it hurt my eyes to even look at
it.  I gotta run away or I'll get tempted to reformat the entire
file...)
2001-12-07 20:20:28 +00:00
Guido van Rossum 4e173846c8 Fix for #489672 (Neil Norwitz): memory leak in test_sre.
(At least for the repeatable test case that Tim produced.)

pattern_subx(): Add missing DECREF(filter) in both exit branches
(normal and error return).  Also fix a DECREF(args) that should
certainly be a DECREF(match) -- because it's inside if (!args) and
right after allocation of match.
2001-12-07 04:25:10 +00:00
Tim Peters eb4b7bad33 audioop_ratecv() again: settle for a sloppier upper bound that's less
obnoxious to compute and easier to explain.  No compromise on safety.
2001-12-07 00:37:39 +00:00
Martin v. Löwis a631f580ea Undefine addrinfo.h constants if the system header defined them.
Fixes #486099.
2001-12-06 19:04:35 +00:00
Jeremy Hylton 2554dd993a Fix [ #489673 ] memory leak in test_symtable: Free the st_future slot.
The st_future slot of the symtable is not freed by PySymtable_Free()
because it is shared by the symtable and compiling structs in
compiel.c.  Since it is shared, it is explicitly deallocated when the
compiling struct is freed.
2001-12-06 14:34:58 +00:00
Tim Peters 3caca2326e SF bug #488514: -Qnew needs work
Big Hammer to implement -Qnew as PEP 238 says it should work (a global
option affecting all instances of "/").

pydebug.h, main.c, pythonrun.c:  define a private _Py_QnewFlag flag, true
iff -Qnew is passed on the command line.  This should go away (as the
comments say) when true division becomes The Rule.  This is
deliberately not exposed to runtime inspection or modification:  it's
a one-way one-shot switch to pretend you're using Python 3.

ceval.c:  when _Py_QnewFlag is set, treat BINARY_DIVIDE as
BINARY_TRUE_DIVIDE.

test_{descr, generators, zipfile}.py:  fiddle so these pass under
-Qnew too.  This was just a matter of s!/!//! in test_generators and
test_zipfile.  test_descr was trickier, as testbinop() is passed
assumptions that "/" is the same as calling a "__div__" method; put
a temporary hack there to call "__truediv__" instead when the method
name is "__div__" and 1/2 evaluates to 0.5.

Three standard tests still fail under -Qnew (on Windows; somebody
please try the Linux tests with -Qnew too!  Linux runs a whole bunch
of tests Windows doesn't):
    test_augassign
    test_class
    test_coercion
I can't stay awake longer to stare at this (be my guest).  Offhand
cures weren't obvious, nor was it even obvious that cures are possible
without major hackery.

Question:  when -Qnew is in effect, should calls to __div__ magically
change into calls to __truediv__?  See "major hackery" at tail end of
last paragraph <wink>.
2001-12-06 06:23:26 +00:00
Tim Peters 3127c28b3f audioop_ratecv(): I left a potentially unsafe multiply unchecked
yesterday -- repair that.  Also renamed the silly size_times_nchannels
to bytes_per_frame.
2001-12-05 22:30:21 +00:00
Fred Drake 8b55b2d9aa Fix memory leak in the parser module: There were two leaks in
parser_tuple2st() and a failure to propogate an error in
build_node_children() (masking yet another leak, of course!).
This closes SF bug #485133 (confirmed by Insure++).
2001-12-05 22:10:44 +00:00
Tim Peters 1691bd9f1e SF bug 482574: audioop.ratecv crashes.
Bugfix candidate.
A numerically naive computation of output buffer size caused crashes
and spurious MemoryErrors for reasonable arguments.
audioop_ratecv():  Avoid spurious overflow by careful reworking of the
buffer size computations, triggering MemoryError if and only if the
final buffer size can't be represented in a C int (although
PyString_FromStringAndSize may legitimately raise MemoryError even if
it does fit in a C int).  All reasonable arguments should work as
intended now, and all unreasonable arguments should be cuaght.
2001-12-05 06:05:07 +00:00
Fred Drake 62c1e3c1b9 Make sure to propogate errors that arise when profiling data cannot be
written to the log file, and turn off the profiler.
This closes SF bug #483925.
2001-12-04 21:40:53 +00:00
Tim Peters 22a51efc1c More sprintf -> PyOS_snprintf. 2001-12-04 01:11:32 +00:00
Tim Peters c8996f5965 posix_execve(), posix_spawnve(), posix_putenv():
sprintf -> PyOS_snprintf.  This is the last of this
stuff I intend to do.
2001-12-03 20:41:00 +00:00
Jack Jansen 55070f5d96 Changed logic for finding python home in Mac OS X framework Pythons.
Now sys.executable points to the executable again, in stead of to
the shared library. The latter is used only for locating the python
home.
2001-12-02 23:56:28 +00:00
Martin v. Löwis f8a6f241b3 Check for NULL return value of PyList_New (follow-up to patch #486743). 2001-12-02 18:31:02 +00:00
Martin v. Löwis b3cfc1d7ea Patch #481718: Time module doc string changes. 2001-12-02 12:27:43 +00:00
Martin v. Löwis 155aad17be Patch #486743: remove bad INCREF, propagate exception in append_objects. 2001-12-02 12:21:34 +00:00
Martin v. Löwis 44ddbde3ab Remove INET6 define. Use ENABLE_IPV6 instead. 2001-12-02 10:15:37 +00:00
Tim Peters 69b83b113f unicodedata_decomposition(): sprintf -> PyOS_snprintf. 2001-11-30 07:23:05 +00:00
Martin v. Löwis c8fe77bd4c Use identity instead of equality when looking for referrers. Fixes #485781. 2001-11-29 18:08:31 +00:00
Tim Peters 75cdad5584 More sprintf -> PyOS_snprintf. 2001-11-28 22:07:30 +00:00
Jeremy Hylton 179c48c60e Use PyOS_snprintf() instead of sprintf(). 2001-11-28 21:49:51 +00:00
Tim Peters 1ceb5fb946 Repair a botched PyOS_snprintf conversion. 2001-11-28 20:32:57 +00:00
Tim Peters 885d457709 sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
2001-11-28 20:27:42 +00:00
Marc-André Lemburg d4c0a9c59b Fixes for possible buffer overflows in sprintf() usages. 2001-11-28 11:47:00 +00:00
Andrew M. Kuchling 3072ecdcd2 Fix docstring typo 2001-11-28 04:28:31 +00:00
Martin v. Löwis e75f0e4801 Correct typo. Fixes #484611. 2001-11-24 09:31:44 +00:00
Martin v. Löwis 560da62fc7 Rename get_referents to get_referrers. Fixes #483815. 2001-11-24 09:24:51 +00:00
Martin v. Löwis fba64e1eca Test for negative buffer sizes. Fixes #482871. 2001-11-19 10:41:26 +00:00
Fred Drake 8188e792d9 assert.h was not always included by Python.h; make sure we import it for
older versions.  (Thanks to Martijn Faassen.)
2001-11-18 02:36:07 +00:00
Barry Warsaw 9b481ff3d6 A change to sync with pickle.py:
find_class(): We no longer mask all exceptions[1] by transforming them
into SystemError.  The latter is definitely not the right thing to do,
so we let any exceptions that occur in the PyObject_GetAttr() call to
simply propagate up if they occur.

[1] Note that pickle only masked ImportError, KeyError, and
AttributeError, but cPickle masked all exceptions.
2001-11-15 23:45:26 +00:00
Tim Peters 5ebfd36afa CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.
This gives mmap() on Windows the ability to create read-only, write-
through and copy-on-write mmaps.  A new keyword argument is introduced
because the mmap() signatures diverged between Windows and Unix, so
while they (now) both support this functionality, there wasn't a way to
spell it in a common way without introducing a new spelling gimmick.
The old spellings are still accepted, so there isn't a backward-
compatibility issue here.
2001-11-13 23:11:19 +00:00
Tim Peters 88d21319ba new_code(): The last patch to this left behind an unreferenced local;
deleted its declaration.
2001-11-13 20:11:55 +00:00
Tim Peters bf5ca65c2d load_string(): Force use of unsigned compare in a context that was
clearly (but incorrectly) assuming it.
2001-11-12 22:26:10 +00:00
Martin v. Löwis 43f2dc6251 Limit string size on one-character-strings. Fixes #480384. 2001-11-11 14:49:15 +00:00
Martin v. Löwis 00ff10cae4 Patch in bug report #477700: Fix memory leaks in gdbm & curses. 2001-11-11 14:24:05 +00:00
Martin v. Löwis 42ba08fab0 Patch #473265: UpdatePairedHandlers nonsensical. 2001-11-10 13:59:16 +00:00
Martin v. Löwis 1d7c55faee Merge 1.42 from PyXML: Flag errors resulting from argument conversion problems.
Fixes problem with not detecting UTF-8 errors.
2001-11-10 13:57:55 +00:00
Jeremy Hylton 9f64caaf00 Use PyObject_CheckReadBuffer(). 2001-11-09 22:02:48 +00:00
Fred Drake 03459a5cd7 Fix memory leak. This is part of SF patch #478006. 2001-11-09 16:00:41 +00:00
Fred Drake f12a68ccd0 Fix memory leak. This is (very!) similar to part of SF patch #478006. 2001-11-09 15:59:36 +00:00
Michael W. Hudson 03f96bd8f5 Fixes to compile cPickle.c & socketmodule.c on cygwin and possibly
other platforms that have funny ideas about whether addresses of
functions in dlls are compile-time constants.
2001-11-09 10:06:23 +00:00
Martin v. Löwis f0b11d2893 Fix memory leaks detecting in bug report #478003. 2001-11-07 08:31:03 +00:00
Andrew M. Kuchling 10f9c075b9 Remove obsolete e-mail address 2001-11-05 21:25:42 +00:00
Tim Peters 603c6831d0 SF patch 473749 compile under OS/2 VA C++, from Michael Muller.
Changes enabling Python to compile under OS/2 Visual Age C++.
2001-11-05 02:45:59 +00:00
Martin v. Löwis 0bd292f004 Correct argument parsing for alp_getstatus, which is METH_VARARGS. 2001-11-03 10:48:43 +00:00
Martin v. Löwis dedbe255d3 Patch #474169: Move fdopen calls out of critical section. 2001-11-02 23:59:11 +00:00
Martin v. Löwis 06b1d21e7d Correct getnameinfo refcounting and tuple parsing. Fixes #476648. 2001-11-02 23:34:52 +00:00
Fred Drake 52a42e9888 Simplify initmd5() to use PyModule_AddIntConstant(). 2001-11-02 22:05:06 +00:00
Fred Drake 8b14ac9898 Clean up a Tab inconsistency.
Simplfy the insint() macro to use PyModule_AddIntConstant().
2001-11-02 22:04:17 +00:00
Andrew M. Kuchling 75fec2c8ed [Patch #476612] Add attributes from PEP247 to the md5 and sha modules 2001-11-02 21:41:00 +00:00
Tim Peters db8656118a has_finalizer(): simplified "if (complicated_bool) 1 else 0" to
"complicated_bool".
2001-11-01 19:35:45 +00:00
Neil Schemenauer a765c120f6 Add has_finalizer predictate function. Use it when deciding which
objects to save in gc.garbage.  This should be the last change needed to
fix SF bug 477059: "__del__ on new classes vs. GC".

Note that this change slightly changes the behavior of the collector.
Before, if a cycle was found that contained instances with __del__
methods then all instance objects in that cycle were saved in
gc.garbage.  Now, only objects with __del__ methods are saved in
gc.garbage.
2001-11-01 17:35:23 +00:00
Guido van Rossum 8cc705eabc SF bug #477059 (my own): __del__ on new classes vs. GC.
When moving objects with a __del__ attribute to a special list, look
for __del__ on new-style classes with the HEAPTYPE flag set as well.
(HEAPTYPE means the class was created by a class statement.)
2001-11-01 14:23:28 +00:00
Neil Schemenauer e8c40cb722 Make the gc.collect() function respect the collection lock. This fixes
SF bug 476129: "gc.collect sometimes hangs".
2001-10-31 23:09:35 +00:00
Guido van Rossum 355bc0c88e Change the limit on the input size for b2a_base64 to what will fit in
memory, rather than the standard's 57.

This fixes SF bug #473009.
2001-10-30 03:00:52 +00:00
Tim Peters c32410ae8f PySocketSock_connect_ex(): On Windows, return the correct Windows exit
code.  The patch is from Jeremy, and allows test_asynchat to run again.
Bugfix candidate.
2001-10-30 01:26:49 +00:00
Fred Drake 4c2e1af890 Make the low-level log-reader object export a dictionary mapping keys
to lists of values, giving the contents of all the ADD_INFO records
seen so far.  This is initialized agressively when the log file is
opened, so that whoever is looking at the log reader can always see
the initial data loaded into the data stream.  ADD_INFO events later
in the log file continue to be reported to the application layer as
before.

Add a new method, addinfo(), to the profiler.  This can be used to
insert additional ADD_INFO records into the profiler log.

Fix the tp_flags and tp_name slots on the type objects.
2001-10-29 20:45:57 +00:00
Guido van Rossum ca6dfa55c5 Oops. In the tp_name field, the name should be "_socket.socket", not
"socket.socket" -- on Windows, "socket.socket" is the wrapper class.
Also added the module name to the SSL type (which is not a new-style
class -- I don't want to mess with it yet).
2001-10-28 12:31:33 +00:00
Guido van Rossum 384ca9c6dd Made SocketType and socket the same thing: a subclassable type whose
constructor acts just like socket() before.  All three arguments have
a sensible default now; socket() is equivalent to
socket(AF_INET, SOCK_STREAM).

One minor issue: the socket() function and the SocketType had
different doc strings; socket.__doc__ gave the signature,
SocketType.__doc__ gave the methods.  I've merged these for now, but
maybe the list of methods is no longer necessary since it can easily
be recovered through socket.__dict__.keys().  The problem with keeping
it is that the total doc string is a bit long (34 lines -- it scrolls
of a standard tty screen).

Another general issue with the socket module is that it's a big mess.
There's pages and pages of random platform #ifdefs, and the naming
conventions are totally wrong: it uses Py prefixes and CapWords for
static functions.  That's a cleanup for another day...  (Also I think
the big starting comment that summarizes the API can go -- it's a
repeat of the docstring.)
2001-10-27 22:20:47 +00:00
Guido van Rossum 9f7a539afe Add sendall() method, which loops until all data is written or an
error occurs, and doesn't return a count.  (This is my second patch
from SF patch #474307, with small change to the docstring for send().)

2.1.2 "bugfix" candidate.
2001-10-26 03:25:00 +00:00
Guido van Rossum a0dfc8577d Fix SF bug #474538: Memory (reference) leak in poller.register (Dave Brueck)
Replace some tortuous code that was trying to be clever but forgot to
DECREF the key and value, by more longwinded but obviously correct
code.

(Inspired by but not copying the fix from SF patch #475033.)
2001-10-25 20:18:35 +00:00
Martin v. Löwis 7c4b5faa93 After discussion with itojun, it was clarified that Tru64 is in error,
and that the work-around should be restricted to that system.
2001-10-25 09:04:03 +00:00
Fredrik Lundh 703ce8122c (experimental) "finditer" method/function. this works pretty much
like findall, but returns an iterator (which returns match objects)
instead of a list of strings/tuples.
2001-10-24 22:16:30 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Martin v. Löwis b8fc972100 Fix typo. Thanks to Jack Jansen for spotting it. 2001-10-24 17:35:46 +00:00
Martin v. Löwis eb9b103296 Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
STRICT_SYSV_CURSES when compiling curses module on HP/UX. Generalize
access to _flags on systems where WINDOW is opaque. Fixes bugs
#432497, #422265, and the curses parts of #467145 and #473150.
2001-10-24 17:10:49 +00:00
Martin v. Löwis 861a65bc2f Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo
not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
2001-10-24 14:36:00 +00:00
Jack Jansen 72af01aac6 Added missing cast. 2001-10-23 22:29:06 +00:00
Jack Jansen 963659af29 Got this to work in MacPython. The code is #ifdef macintosh style (to match the existing #ifdef MS_WINDOWS), but eventually ifdeffing on configure features is probably better. 2001-10-23 22:26:16 +00:00
Fred Drake 0d429e8cdd Convert the ref() and proxy() implementations to use the new
PyArg_UnpackTuple() function (serves as an example and test case).
2001-10-23 21:12:47 +00:00
Fredrik Lundh 6de22ef677 another major speedup: let sre.sub/subn check for escapes in the
template string, and don't call the template compiler if we can
avoid it.
2001-10-22 21:18:08 +00:00
Fredrik Lundh f864aa8fd9 sre.split should return the last segment, even if empty
(sorry, barry)
2001-10-22 06:01:56 +00:00
Neil Schemenauer 2677512fc1 Adding missing "static" declarations (found by "make smelly"). 2001-10-21 22:26:43 +00:00
Fredrik Lundh dac58492aa fixed character set description in docstring (SRE uses Python
strings, not C strings)

removed USE_PYTHON defines, and related sre.py helpers

skip calling the subx helper if the template is callable.
interestingly enough, this means that

	def callback(m):
	    return literal
	result = pattern.sub(callback, string)

is much faster than

	result = pattern.sub(literal, string)
2001-10-21 21:48:30 +00:00
Fredrik Lundh 1296a8d77e sre.Scanner fixes (from Greg Chapman). also added a Scanner sanity
check to the test suite.

added a few missing exception checks in the _sre module
2001-10-21 18:04:11 +00:00
Fredrik Lundh bec95b9d88 rewrote the pattern.sub and pattern.subn methods in C
removed (conceptually flawed) getliteral helper; the new sub/subn code
uses a faster code path for literal replacement strings, but doesn't
(yet) look for literal patterns.

added STATE_OFFSET macro, and use it to convert state.start/ptr to
char indexes
2001-10-21 16:47:57 +00:00
Martin v. Löwis 5b68ce3122 Change clear_handlers argument to indicate whether this is an initialization.
Do not set the Expat handlers if it is. Fixes PyXML bug #473195.
2001-10-21 08:53:52 +00:00
Fredrik Lundh 971e78b55b rewrote the pattern.split method in C
also restored SRE Unicode support for 1.6/2.0/2.1
2001-10-20 17:48:46 +00:00
Andrew M. Kuchling 16e65a023e Add two forgotten 'break' statements
Allow passing strings to the .border() method
Correct some error messages ("1 or 4" -> "1 to 4")
Bump version number
Tweak code formatting
Update my e-mail address
2001-10-20 16:05:52 +00:00
Guido van Rossum cad8fa1501 (Hopefully) fix SF bug #472675: CVS socketmodule now doesn't compile
This appears to be a case of a missing \n\ in a multiline string
literal.
2001-10-19 12:40:40 +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 4fe3c27323 Expose O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW. 2001-10-18 22:05:36 +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 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
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
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
Martin v. Löwis 61c5edf6fc Expose setgroups. Fixes feature request #468116. 2001-10-18 04:06:00 +00:00
Jeremy Hylton de80f2efb5 Expose three OpenSSL API calls for dealing with the PRNG.
Quoth the OpenSSL RAND_add man page:

    OpenSSL makes sure that the PRNG state is unique for each
    thread. On systems that provide /dev/urandom, the
    randomness device is used to seed the PRNG transparently.
    However, on all other systems, the application is
    responsible for seeding the PRNG by calling RAND_add(),
    RAND_egd(3) or RAND_load_file(3).

I decided to expose RAND_add() because it's general and RAND_egd()
because it's a useful special case.  RAND_load_file() didn't seem to
offer much over RAND_add(), so I skipped it.  Also supplied
RAND_status() which returns true if the PRNG is seeded and false if
not.
2001-10-18 00:28:50 +00:00
Jeremy Hylton a25d995ab0 The Python symtable module depends on .h files that setup.py doesn't track. 2001-10-17 13:46:44 +00:00
Jeremy Hylton 771f9146d5 Remove unused convenience routine. 2001-10-17 13:32:02 +00:00
Tim Peters adbd35bbcc Simplify and regularize docstrings. Also reformat so that each docstring
line fits in reasonable screen width.
2001-10-17 04:16:15 +00:00
Tim Peters 977e540e4b Trimmed trailing whitespace. 2001-10-17 03:57:20 +00:00
Tim Peters b1a37c0196 Removed more comments that didn't make much sense.
Made the presence/absence of a semicolon after macros consistent.
2001-10-17 03:56:45 +00:00
Tim Peters 6605c64c83 Removed obsolete comments about confused string refcount tricks (Jeremy
removed the tricks).

Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a
new block is neither necessary nor helpful).
2001-10-17 03:43:54 +00:00
Jeremy Hylton ba3dd9990f Undo needless INCREF chicanery introduced by SF patch #450702.
Apparently this patch (rev 2.41) replaced all the good old "s#"
    formats in PyArg_ParseTuple() with "S".  Then it did
    PyString_FromStringAndSize() to get back the values setup by the
    "s#" format.  It also incref'd and decref'd the string obtained by
    "S" even though the argument tuple had a reference to it.

Replace PyString_AsString() calls with PyString_AS_STRING().

    A good rule of thumb -- if you never check the return value of
    PyString_AsString() to see if it's NULL, you ought to be using the
    macro <wink>.
2001-10-16 23:26:08 +00:00
Jeremy Hylton 9d620d018c Simplify and fix error handling for most cases.
Many functions used a local variable called return_error, which was
initialized to zero.  If an error occurred, it was set to true.  Most
of the code paths checked were only executed if return_error was
false.  goto is clearer.

The code also seemed to be written under the curious assumption that
calling Py_DECREF() on a local variable would assign the variable to
NULL.  As a result, more of the error-exit code paths returned an
object that had a reference count of zero instead of just returning
NULL.  Fixed the code to explicitly assign NULL after the DECREF.

A bit more reformatting, but not much.

XXX Need a much better test suite for zlib, since it the current tests
don't exercise any of this broken code.
2001-10-16 23:02:32 +00:00
Jeremy Hylton 4990000077 More reformatting. 2001-10-16 21:59:35 +00:00
Jeremy Hylton 0965e084cd Add zlib_error() helper.
It sets a ZlibError exception, using the msg from the z_stream pointer
if one is available.
2001-10-16 21:56:09 +00:00
Jeremy Hylton 9bc9d66eb1 Remove many calls to set MemoryError exceptions.
When PyString_FromStringAndSize() and _PyString_Resize() fail, they
set an exception.  There's no need to set a new exception.
2001-10-16 21:23:58 +00:00
Jeremy Hylton 9714f99d60 Reformat!
Consistently indent 4 spaces.
Use whitespace around operators.
Put braces in the right places.
2001-10-16 21:19:45 +00:00
Guido van Rossum 3c28863e08 Partial patch from SF #452266, by Jason Petrone.
This changes Pythread_start_thread() to return the thread ID, or -1
for an error.  (It's technically an incompatible API change, but I
doubt anyone calls it.)
2001-10-16 21:13:49 +00:00
Jeremy Hylton 511e2cacc4 [ #403753 ] zlib decompress; uncontrollable memory usage
Mostly by Toby Dickenson and Titus Brown.

Add an optional argument to a decompression object's decompress()
method.  The argument specifies the maximum length of the return
value.  If the uncompressed data exceeds this length, the excess data
is stored as the unconsumed_tail attribute.  (Not to be confused with
unused_data, which is a separate issue.)

Difference from SF patch: Default value for unconsumed_tail is ""
rather than None.  It's simpler if the attribute is always a string.
2001-10-16 20:39:49 +00:00
Jeremy Hylton 3eb46f3a5d Must terminate the Pickler_members[] and Pickler_getsets with NULL. 2001-10-16 17:10:49 +00:00
Fred Drake 30d1c75d15 Removed useless code to count the number of calls into the profiler.
Added support for saving the names of the functions observed into the
profile log.
Added support for using the profiler to measure coverage without collecting
timing information (which is the slow part).  Coverage logs can also be
substantially smaller than profiling logs where per-line information is
being collected.
Updated comments on the log format; corrected record type values in some
of the record descriptions.
2001-10-15 22:11:02 +00:00
Jeremy Hylton 499ab6a653 Better fix for core dumps on recursive objects in fast mode.
Raise ValueError when an object contains an arbitrarily nested
reference to itself.  (The previous fix just produced invalid
pickles.)

Solution is very much like Py_ReprEnter() and Py_ReprLeave():
fast_save_enter() and fast_save_leave() that tracks the fast_container
limit and keeps a fast_memo of objects currently being pickled.

The cost of the solution is moderately expensive for deeply nested
structures, but it still seems to be faster than normal pickling,
based on tests with deeply nested lists.

Once FAST_LIMIT is exceeded, the new code is about twice as slow as
fast-mode code that doesn't check for recursion.  It's still twice as
fast as the normal pickling code.  In the absence of deeply nested
structures, I couldn't measure a difference.
2001-10-15 21:37:58 +00:00
Guido van Rossum 2ef1b8fd97 Remove a couple of tp_xxx fields that you are not expected to
initialize (or use or even know about :-).
2001-10-15 21:24:12 +00:00
Guido van Rossum 17209fcf1f Fix a bunch of warnings reported by Skip.
To whoever who changed a bunch of (PyCFunction) casts to
(PyNoArgsFunction) in PyMethodDef initializers: don't do that.  The
cast is to shut the compiler up.  The compiler wants the function
pointer initializer to be a PyCFunction.
2001-10-15 21:12:54 +00:00
Guido van Rossum 1c917072ca Very subtle syntax change: in a list comprehension, the testlist in
"for <var> in <testlist> may no longer be a single test followed by
a comma.  This solves SF bug #431886.  Note that if the testlist
contains more than one test, a trailing comma is still allowed, for
maximum backward compatibility; but this example is not:

    [(x, y) for x in range(10), for y in range(10)]
                              ^

The fix involved creating a new nonterminal 'testlist_safe' whose
definition doesn't allow the trailing comma if there's only one test:

    testlist_safe: test [(',' test)+ [',']]
2001-10-15 15:44:05 +00:00
Martin v. Löwis 1c07b4b4fb Test for __sun instead of __sun__, since SUNWspro only defines the latter;
gcc defines both.
2001-10-13 09:00:42 +00:00
Martin v. Löwis a38d9169bc Cast argument to set_panel_userptr to void*. Fixes bug #417240. 2001-10-13 08:50:10 +00:00
Tim Peters 7d99ff27e8 Speed the Windows code by using native 64-bit int compiler support instead
of calling external functions.
2001-10-13 07:37:52 +00:00
Tim Peters 1b6e08a25e This compiles on Windows now. 2001-10-13 00:14:28 +00:00
Tim Peters feab23f834 My editor can't deal with long backslash-continued strings. Changed 'em.
This still doesn't compile on Windows, but at least I have a shot at
fixing that now.
2001-10-13 00:11:10 +00:00
Tim Peters 1566a17af5 Get hotshot closer to compiling on Windows.
Still broken:  GETTIMEOFDAY.  This macro obviously isn't being defined
on Windows, so there's logic errors here I'd rather Fred untangled.
2001-10-12 22:08:39 +00:00
Fred Drake 8c081a1584 The HotShot core: look, ma, no hands! 2001-10-12 20:57:55 +00:00
Guido van Rossum bca8c2ebea Use double curly braces for the generation0/1/2 initializers, to shut
up GCC warnings.
2001-10-12 20:52:48 +00:00
Guido van Rossum 716aac0448 PySocket_getaddrinfo(): fix two refcount bugs, both having to do with
a misunderstanding of the refcont behavior of the 'O' format code in
PyArg_ParseTuple() and Py_BuildValue(), respectively.

- pobj is only a borrowed reference, so should *not* be DECREF'ed at
  the end.  This was the cause of SF bug #470635.

- The Py_BuildValue() call would leak the object produced by
  makesockaddr().  (I found this by eyeballing the code.)
2001-10-12 18:59:27 +00:00
Jeremy Hylton a0fb177be8 Progress on SF bug #466175 and general cleanup.
Add a fast_container member to Picklerobject.  If fast is true, then
fast_container counts the depth of nested container calls.  If the
depth exceeds FAST_LIMIT (2000), the fast flag is ignored and the
normal checks occur.  This approach is much like the approach for
prevent stack overflow for comparison and reprs of recursive objects
(e.g. [[...]]).

    - Fast container used for save_list(), save_dict(), and
      save_inst().

      XXX Not clear which other save_xxx() functions should use it.

Make Picklerobject into new-style types, using PyObject_GenericGetAttr()
and PyObject_GenericSetAttr().

    - Use PyMemberDef for binary and fast members

    - Use PyGetSetDef for persistent_id, inst_persistent_id, memo, and
      PicklingError.

      XXX Not all of these seem like they need to use getset, but it's
      not clear why the old getattr() and setattr() had such odd
      semantics.  One change is that the getvalue() attribute will
      exist on all Picklers, not just list-based picklers; I think
      this is a more rationale interface.

There is a long laundry list of other changes:

    - Remove unused #defines for PyList_SET_ITEM() etc.

    - Make some of the indentation consistent

    - Replace uses of cPickle_PyMapping_HasKey() where the first
      argument is self->memo with calls to PyDict_GetItem(), because
      self->memo must be a dictionary.

    - Don't bother to check if cPickle_PyMapping_HasKey() returns < 0,
      because it can only return 0 or 1.

    - Replace uses of PyObject_CallObject() with PyObject_Call(), when
      we can guarantee that the argument tuple is really a tuple.

Performance impacts of these changes:

    - 5% speedup for normal pickling

    - No change to fast-mode pickling.

XXX Really need tests for all the features in cPickle that aren't in
pickle.
2001-10-12 04:11:06 +00:00
Tim Peters 9e4ca10ce4 SF bug [#467145] Python 2.2a4 build problem on HPUX 11.0.
The platform requires 8-byte alignment for doubles, but the GC header
was 12 bytes and that threw off the natural alignment of the double
members of a subtype of complex.  The fix puts the GC header into a
union with a double as the other member, to force no-looser-than
double alignment of GC headers.  On boxes that require 8-byte alignment
for doubles, this may add pad bytes to the GC header accordingly; ditto
for platforms that *prefer* 8-byte alignment for doubles.  On platforms
that don't care, it shouldn't change the memory layout (because the
size of the old GC header is certainly greater than the size of a double
on all platforms, so unioning with a double shouldn't change size or
alignment on such boxes).
2001-10-11 18:31:31 +00:00
Jeremy Hylton e2adc6c205 Use PySocket_Err() instead of PyErr_SetFromErrno().
The former does the right thing on Windows, the latter does not.
2001-10-11 17:27:58 +00:00
Jeremy Hylton ba69936037 Commit parts of SF patch #462759
Use #define X509_NAME_MAXLEN for server/issuer length on an SSL
object.

Update doc strings for socket.ssl() and ssl methods read() and
write().

PySSL_SSLwrite(): Check return value and raise exception on error.
Use int for len instead of size_t.  (All the function the size_t obj
was passed to our from expected an int!)

PySSL_SSLread(): Check return value of PyArg_ParseTuple()!  More
robust checks of return values from SSL_read().
2001-10-11 17:23:34 +00:00
Jeremy Hylton ae0013d3aa Convert socket methods to use METH_O and METH_NOARGS where possible. 2001-10-11 16:36:35 +00:00
Jeremy Hylton 57ca873c77 Add a bunch of SSL error constants 2001-10-11 00:00:17 +00:00
Jeremy Hylton 5b6ce5a2b5 Lots of code reorganization with a few small API changes.
Change all the local names that start with SSL to start with PySSL.
The OpenSSL library defines lots of calls that start with "SSL_".  The
calls for Python's SSL objects also started with "SSL_".  This choice
made it really confusing to figure out which calls were to the library
and which calls were local to the file.

Add PySSL_SetError() that sets an exception based on the information
from SSL_get_error().  This function will eventually replace all the
calls that set it with an error message that is based on the name of
the call that failed rather than the reason it failed.  (Example: If
SSL_connect() failed it used to report "SSL_connect error" now it will
offer a specific message about why SSL_connect failed.)

    XXX It might be helpful to augment the error message generated
    below with the name of the SSL function that generated the error.
    I expect it's obvious most of the time.

Remove several unnecessary INCREFs in the module's constructor call.
PyDict_SetItem() and friends do the INCREF for you.
2001-10-10 23:55:43 +00:00
Jeremy Hylton 22738b9bc1 Do simple error checking before doing any SSL calls. 2001-10-10 22:37:48 +00:00
Jeremy Hylton b0b0bd6cc6 USe PyObject_SetString() instead of PyObject_SetObject() in newSSLObject(). 2001-10-10 22:33:32 +00:00
Jeremy Hylton ec4b545014 In newSSLObject(), initialize the various members of an SSLObject to NULL.
In SSL_dealloc(), free/dealloc them only if they're non-NULL.

Fixes some obvious core dumps, but not sure yet if there are more
semantics to the SSL calls that would affect the dealloc.
2001-10-10 03:37:05 +00:00
Jeremy Hylton ab0064574b A bit of reformatting to match the standard style 2001-10-10 03:33:24 +00:00
Jeremy Hylton f86d63e4f0 Fix two memory leaks in socket.ssl().
XXX [1] These changes aren't tested very thoroughly, because regrtest
doesn't do any SSL tests.  I've done some trivial tests on my own, but
don't really know how to use the key and cert files.  In one case, an
SSL-level error causes Python to dump core.  I'll get the fixed in the
next round of changes.

XXX [2] The checkin removes the x_attr member of the SSLObject struct.
I'm not sure if this is kosher for backwards compatibility at the
binary level.  Perhaps its safer to keep the member but keep it
assigned to NULL.

And the leaks?

newSSLObject() called PyDict_New(), stored the result in x_attr
without checking it, and later stored NULL in x_attr without doing
anything to the dict.  So the dict always leaks.  There is no further
reference to x_attr, so I just removed it completely.

The error cases in newSSLObject() passed the return value of
PyString_FromString() directly to PyErr_SetObject().
PyErr_SetObject() expects a borrowed reference, so the string leaked.
2001-10-10 03:19:39 +00:00
Martin v. Löwis 1dbce44b91 Update URL. Fixes bug #468118. 2001-10-09 10:54:31 +00:00
Martin v. Löwis ffa7aff751 Add additional fields to Xxo_Type declaration. Fixes bug #469250. 2001-10-09 10:46:58 +00:00
Tim Peters f2a67daca2 Guido suggests, and I agree, to insist that SIZEOF_VOID_P be a power of 2.
This simplifies the rounding in _PyObject_VAR_SIZE, allows to restore the
pre-rounding calling sequence, and allows some nice little simplifications
in its callers.  I'm still making it return a size_t, though.
2001-10-07 03:54:51 +00:00
Tim Peters 6d483d3477 _PyObject_VAR_SIZE: always round up to a multiple-of-pointer-size value.
As Guido suggested, this makes the new subclassing code substantially
simpler.  But the mechanics of doing it w/ C macro semantics are a mess,
and _PyObject_VAR_SIZE has a new calling sequence now.

Question:  The PyObject_NEW_VAR macro appears to be part of the public API.
Regardless of what it expands to, the notion that it has to round up the
memory it allocates is new, and extensions containing the old
PyObject_NEW_VAR macro expansion (which was embedded in the
PyObject_NEW_VAR expansion) won't do this rounding.  But the rounding
isn't actually *needed* except for new-style instances with dict pointers
after a variable-length blob of embedded data.  So my guess is that we do
not need to bump the API version for this (as the rounding isn't needed
for anything an extension can do unless it's recompiled anyway).  What's
your guess?
2001-10-06 21:27:34 +00:00
Tim Peters 406fe3b1c0 Repaired the debug Windows deaths in test_descr, by allocating enough
pad memory to properly align the __dict__ pointer in all cases.

gcmodule.c/objimpl.h, _PyObject_GC_Malloc:
+ Added a "padding" argument so that this flavor of malloc can allocate
  enough bytes for alignment padding (it can't know this is needed, but
  its callers do).

typeobject.c, PyType_GenericAlloc:
+ Allocated enough bytes to align the __dict__ pointer.
+ Sped and simplified the round-up-to-PTRSIZE logic.
+ Added blank lines so I could parse the if/else blocks <0.7 wink>.
2001-10-06 19:04:01 +00:00
Tim Peters 8c18f25850 _PyObject_GC_Malloc(): split a complicated line in two. As is, there was
no way to talk the debugger into showing me how many bytes were being
allocated.
2001-10-06 08:03:20 +00:00
Fred Drake f7f8cad548 Adjust the _weakref module to use the public API for the weak reference
objects.  This is now simply a shim to give weakref.py access to the
underlying implementation.
2001-10-05 22:00:24 +00:00
Andrew M. Kuchling 38300c631a Fix typo in docstring 2001-10-05 12:24:15 +00:00
Martin v. Löwis 244edc8985 Add chroot call. Implements feature #459267. 2001-10-04 22:44:26 +00:00
Greg Ward a645b30294 Add various typecasts (back and forth from char * to unsigned char *)
to make the SGI C compiler happier (bug #445960).
2001-10-04 14:54:53 +00:00
Tim Peters 1ce3cf7749 SF patch [#466877] SIGBREAK is missing from signal module.
Patch from Steve Scott to add SIGBREAK support (unique to Windows).
2001-10-01 17:58:40 +00:00
Martin v. Löwis 0daad598d0 Patch #462122: add readline startup and pre_event hooks. 2001-09-30 21:09:59 +00:00
Martin v. Löwis 16dc7f44b1 Patch #462190, patch #464070: Support quoted printable in the binascii module.
Decode and encode underscores for header style encoding. Fixes bug #463996.
2001-09-30 20:32:11 +00:00
Tim Peters d38b1c74f3 SF [#466125] PyLong_AsLongLong works for any integer.
Generalize PyLong_AsLongLong to accept int arguments too.  The real point
is so that PyArg_ParseTuple's 'L' code does too.  That code was
undocumented (AFAICT), so documented it.
2001-09-30 05:09:37 +00:00
Guido van Rossum e296cedef9 Be more rigorous about making pathnames absolute, to address SF bug
#424002.

Refactor init_path_from_argv0() and rename to copy_absolute(); add
absolutize() which does the same in-place.

Clean up whitespace (leading tabs -> spaces, delete trailing
spaces/tabs).
2001-09-28 20:00:29 +00:00
Jeremy Hylton ede049b2d3 Add tests for new PyErr_NormalizeException() behavior
Add raise_exception() to the _testcapi module.  It isn't a test, but
the C API exists only to support test_exceptions.  raise_exception()
takes two arguments -- an exception class and an integer specifying
how many arguments it should be called with.

test_exceptions uses BadException() to test the interpreter's behavior
when there is a problem instantiating the exception.  test_capi1()
calls it with too many arguments.  test_capi2() causes an exception to
be raised in the Python code of the constructor.
2001-09-26 20:01:13 +00:00
Guido van Rossum 10b164a32d SF patch #459385 (Norman Vine): time.timezone fix for Cygwin.
Also did some whitespace normalization.
2001-09-25 13:59:01 +00:00
Marc-André Lemburg e47df7a211 StringIO patch #462596: let's [c]StringIO accept read buffers on
input to .write() too.
2001-09-24 17:34:52 +00:00
Martin v. Löwis 287620f50d Patch #463421: speed up md5 module with real memcpy/set. 2001-09-24 17:14:40 +00:00
Martin v. Löwis 894258cebe Reactivate participation of expat parsers in GC. Fixes bug #462710. 2001-09-23 10:20:10 +00:00
Barry Warsaw 3e8be722d9 I_getiter(): Function for the tp_iter slot of Itype so that
cStringIO's can participate in the iterator protocol.

Fill the Itype.tp_iter slot with I_getiter()
2001-09-22 04:36:49 +00:00
Guido van Rossum 32d34c809f Add optional docstrings to getset descriptors. Fortunately, there's
no backwards compatibility to worry about, so I just pushed the
'closure' struct member to the back -- it's never used in the current
code base (I may eliminate it, but that's more work because the getter
and setter signatures would have to change.)

As examples, I added actual docstrings to the getset attributes of a
few types: file.closed, xxsubtype.spamdict.state.
2001-09-20 21:45:26 +00:00
Guido van Rossum 6f7993765a Add optional docstrings to member descriptors. For backwards
compatibility, this required all places where an array of "struct
memberlist" structures was declared that is referenced from a type's
tp_members slot to change the type of the structure to PyMemberDef;
"struct memberlist" is now only used by old code that still calls
PyMember_Get/Set.  The code in PyObject_GenericGetAttr/SetAttr now
calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef
argument.

As examples, I added actual docstrings to the attributes of a few
types: file, complex, instance method, super, and xxsubtype.spamlist.

Also converted the symtable to new style getattr.
2001-09-20 20:46:19 +00:00
Guido van Rossum 461591eb17 PyLocale_setlocale(): silence compiler warning about free() of a const
char *.
2001-09-20 19:18:30 +00:00
Marc-André Lemburg c60e6f7771 Patch #435971: UTF-7 codec by Brian Quinlan. 2001-09-20 10:35:46 +00:00
Martin v. Löwis 7090ed16d7 Include ctype.h after Python.h. 2001-09-19 10:37:50 +00:00
Martin v. Löwis c57428d3a0 Patch to bug #461753: Allow None in ExternalEntityParserCreate. 2001-09-19 09:55:09 +00:00
Fredrik Lundh 59b68656f8 fixed #449964: sre.sub raises an exception if the template contains a
\g<x> group reference followed by a character escape

(also restructured a few things on the way to fixing #449000)
2001-09-18 20:55:24 +00:00
Fredrik Lundh 21009b9c6f an SRE bugfix a day keeps Guido away...
#462270: sub-tle difference between pre.sub and sre.sub.  PRE ignored
an empty match at the previous location, SRE didn't.

also synced with Secret Labs "sreopen" codebase.
2001-09-18 18:47:09 +00:00
Andrew M. Kuchling fda3c3ddae [Patch #462255, from Jason Tishler] Re-enables building the resouce
module on the Cygwin platform.
2001-09-17 16:19:16 +00:00
Tim Peters 0891ac017d The 'p' (Pascal string) pack code acts unreasonably when the string size
and count exceed 255.  Changed to preserve as much of the string as
possible (instead of count%256 characters).
2001-09-15 02:35:15 +00:00
Martin v. Löwis caef93d82c Silence warnings about passing unsigned char** as char**. 2001-09-08 16:23:34 +00:00
Martin v. Löwis 3bd8c1ee47 Patch #450702: allow threads when calling into zlib, protect usage of
the module in multiple threads with a global lock.
2001-09-07 16:27:31 +00:00
Martin v. Löwis 39e0c5daeb Fix compiler warnings. This closes some of the #458880 problem. 2001-09-07 16:10:00 +00:00
Martin v. Löwis 387c547fd3 Revert parts of patch #453627, documenting the resulting test failures
instead.
2001-09-06 08:16:17 +00:00
Tim Peters 6e13a562ae Enable large file support on Win32 systems.
Curious:  the MS docs say stati64 etc are supported even on Win95, but
Win95 doesn't support a filesystem that allows partitions > 2 Gb.

test_largefile:  This was opening its test file in text mode.  I have no
idea how that worked under Win64, but it sure needs binary mode on Win98.
BTW, on Win98 test_largefile runs quickly (under a second).
2001-09-06 00:32:15 +00:00
Tim Peters a40c793d06 Rework the way we try to check for libm overflow, given that C99 no longer
requires that errno ever get set, and it looks like glibc is already
playing that game.  New rules:

+ Never use HUGE_VAL.  Use the new Py_HUGE_VAL instead.

+ Never believe errno.  If overflow is the only thing you're interested in,
  use the new Py_OVERFLOWED(x) macro.  If you're interested in any libm
  errors, use the new Py_SET_ERANGE_IF_OVERFLOW(x) macro, which attempts
  to set errno the way C89 said it worked.

Unfortunately, none of these are reliable, but they work on Windows and I
*expect* under glibc too.
2001-09-05 22:36:56 +00:00
Martin v. Löwis 7c82a3e0fc Patch #449815: Set filesystemencoding based on CODESET. 2001-09-05 17:09:48 +00:00
Martin v. Löwis 655c9557f6 Patch #453627: Define the following macros when compiling on a UnixWare 7.x system:
SCO_ATAN2_BUG, SCO_ACCEPT_BUG, and STRICT_SYSV_CURSES.
Work aroudn a bug in the SCO UnixWare atan2() implementation.
2001-09-05 14:45:54 +00:00
Tim Peters e5ca6c71cd loghelper(): Try to nudge the compiler into doing mults in an order that
minimizes roundoff error.
2001-09-05 04:33:11 +00:00
Tim Peters 785261684e Return reasonable results for math.log(long) and math.log10(long) (we were
getting Infs, NaNs, or nonsense in 2.1 and before; in yesterday's CVS we
were getting OverflowError; but these functions always make good sense
for positive arguments, no matter how large).
2001-09-05 00:53:45 +00:00
Tim Peters 63c9453929 Mechanical fiddling to make this easier to work with in my editor.
Repaired the ldexp docstring (said the name of the func was "ldexp_doc").
2001-09-04 23:17:42 +00:00
Andrew M. Kuchling 4a596e3bee [Bug #457654] bkgd() used a hard-coded A_NORMAL attribute, when it should
have used the attribute argument provided as a parameter
2001-09-04 19:34:32 +00:00
Guido van Rossum 1832de4bc0 PEP 238 documented -Qwarn as warning only for classic int or long
division, and this makes sense.  Add -Qwarnall to warn for all
classic divisions, as required by the fixdiv.py tool.
2001-09-04 03:51:09 +00:00
Guido van Rossum 61c345fa37 Rename the -D option to -Q, to avoid a Jython option name conflict. 2001-09-04 03:26:15 +00:00
Guido van Rossum 97741a3041 Oops. The -W option takes args, not -X. 2001-08-31 18:17:13 +00:00
Guido van Rossum 393661d15f Add warning mode for classic division, almost exactly as specified in
PEP 238.  Changes:

- add a new flag variable Py_DivisionWarningFlag, declared in
  pydebug.h, defined in object.c, set in main.c, and used in
  {int,long,float,complex}object.c.  When this flag is set, the
  classic division operator issues a DeprecationWarning message.

- add a new API PyRun_SimpleStringFlags() to match
  PyRun_SimpleString().  The main() function calls this so that
  commands run with -c can also benefit from -Dnew.

- While I was at it, I changed the usage message in main() somewhat:
  alphabetized the options, split it in *four* parts to fit in under
  512 bytes (not that I still believe this is necessary -- doc strings
  elsewhere are much longer), and perhaps most visibly, don't display
  the full list of options on each command line error.  Instead, the
  full list is only displayed when -h is used, and otherwise a brief
  reminder of -h is displayed.  When -h is used, write to stdout so
  that you can do `python -h | more'.

Notes:

- I don't want to use the -W option to control whether the classic
  division warning is issued or not, because the machinery to decide
  whether to display the warning or not is very expensive (it involves
  calling into the warnings.py module).  You can use -Werror to turn
  the warnings into exceptions though.

- The -Dnew option doesn't select future division for all of the
  program -- only for the __main__ module.  I don't know if I'll ever
  change this -- it would require changes to the .pyc file magic
  number to do it right, and a more global notion of compiler flags.

- You can usefully combine -Dwarn and -Dnew: this gives the __main__
  module new division, and warns about classic division everywhere
  else.
2001-08-31 17:40:15 +00:00
Sjoerd Mullender 89dfe9e292 Removed unreachable return to silence SGI compiler. 2001-08-30 14:37:07 +00:00
Sjoerd Mullender 6f848c175f Removed an unreachable break statement to silence SGI compiler. 2001-08-30 14:15:38 +00:00
Neil Schemenauer 45c9ae5c97 gcmodule is now always compiled 2001-08-30 00:13:38 +00:00
Neil Schemenauer 7d0e19e1f4 gcmodule is now enabled here 2001-08-30 00:12:32 +00:00
Neil Schemenauer 43411b5683 Make more things internal to this file. Remove
visit_finalizer_reachable since it's the same as visit_reachable.
Rename visit_reachable to visit_move.  Objects can now have the GC type
flag set, reachable by tp_traverse and not be in a GC linked list.  This
should make the collector more robust and easier to use by extension
module writers.  Add memory management functions for container objects
(new, del, resize).
2001-08-30 00:05:51 +00:00
Neil Schemenauer e83c00efd0 Use new GC API. 2001-08-29 23:54:21 +00:00
Neil Schemenauer 01b66a80c4 Remove bogus PyGC_HEAD_SIZE. 2001-08-29 23:50:42 +00:00
Tim Peters 79248aa1e4 SF bug [#456252] Python should never stomp on [u]intptr_t.
pyport.h:  typedef a new Py_intptr_t type.
    DELICATE ASSUMPTION:  That HAVE_UINTPTR_T implies intptr_t is
    available as well as uintptr_t.  If that turns out not to be
    true, things must get uglier (C99 wants both, so I think it's
    an assumption we're *likely* to get away with).
thread_nt.h, PyThread_start_new_thread:  MS _beginthread is documented
    as returning unsigned long; no idea why uintptr_t was being used.
Others:  Always use Py_[u]intptr_t, never [u]intptr_t directly.
2001-08-29 21:37:10 +00:00
Tim Peters 12778e314b load_int: The fallback to long ints was coded in such a way that it
couldn't succeed.  Fixed.
2001-08-28 22:08:34 +00:00
Tim Peters 402d5985d8 SF patch [ #455137 ] Makes popen work with COMMAND.COM on WNT, from
Brian Quinlan.
2001-08-27 06:37:48 +00:00
Tim Peters 89675078cb Back out trying to use the C values for CO_xxx.
__future__.py reverted to 1.9.
newmodule.c reverted to 2.32.
2001-08-24 06:29:12 +00:00
Barry Warsaw 60f018846d Merge changes from r22a2-branch back into trunk. Also, change patch
level to 2.2a2+
2001-08-22 19:24:42 +00:00
Skip Montanaro 1a10aac87c make the gettmarg error message more correct by making it more vague ;-)
see SF bug 434143, part of which this addresses
2001-08-22 12:39:16 +00:00
Barry Warsaw cfb1675736 SSL_dealloc(): Apply the change suggested in SF bug #425370 which
changes the order of the free calls to be the reverse of the alloc
    calls.  Closes that bug.
2001-08-20 22:26:24 +00:00
Jeremy Hylton 1ba6bada67 It will always be a string, because it is created just before this call. 2001-08-20 19:06:36 +00:00
Guido van Rossum a92d16aaec SF patch #452239 by Gordon McMillan, to fix SF bug #451547.
This patch attempts to do to cPickle what Guido did
   for pickle.py v 1.50. That is: save_global tries
   importing the module, and fetching the name from the
   module. If that fails, or the returned object is not
   the same one we started with, it raises a
   PicklingError. (All this so pickling a lambda will
   fail at save time, rather than load time).
2001-08-18 21:22:07 +00:00
Tim Peters aa32070f4d Expose the CO_xxx flags via the "new" module (re-solving a problem "the
right way").  Fiddle __future__.py to use them.

Jeremy's pyassem.py may also want to use them (by-hand duplication of
magic numbers is brittle), but leaving that to his judgment.

Beef up __future__'s test to verify the exported feature names appear
correct.
2001-08-18 20:18:49 +00:00
Skip Montanaro 95618b5bc9 added warnings about security risk of using tmpnam and tempnam 2001-08-18 18:52:10 +00:00
Martin v. Löwis 339d0f720e Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
2001-08-17 18:39:25 +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
Barry Warsaw 214a0b1382 init_sre(): Plug a little leak reported by Insure. 2001-08-16 20:33:48 +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 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
Guido van Rossum 83f56cb2db Change the type names to xxsublist.<name>. 2001-08-16 09:10:42 +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
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 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
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
Martin v. Löwis f65b1a175f Bump size of sprintf buffer. Suggested by Alex Coventry. 2001-08-12 09:28:40 +00:00
Martin v. Löwis 1ba3fd5d51 Autotest for netpacket/packet.h, as it is not available on all Linux versions.
Depend AF_PACKET on HAVE_NETPACKET_PACKET_H. Fixes #449157
2001-08-10 20:29:40 +00:00
Martin v. Löwis c4416d5a2c _DATE_FMT does not always accompany CODESET. 2001-08-10 19:41:45 +00:00
Neil Schemenauer 17e7be60b4 Remove "referents" structure (it's not needed). Check return value
of PyList_Append.
2001-08-10 14:46:47 +00:00
Martin v. Löwis 9b75dca192 Expose nl_langinfo through locale where available. 2001-08-10 13:58:50 +00:00
Fred Drake 428e75fc3e Add wrappers around the rich-comparison operations.
This closes SF patch #428320.

Add wrappers to expose "floor" and "true" division.
This closes SF feature request #449093.
2001-08-09 20:14:34 +00:00
Neil Schemenauer c7c8d8e32d Add get_objects function. This is a low level function (like
get_referents, and is not yet documented in the library manual).
Suggestions for a better name welcome.
2001-08-09 15:58:59 +00:00
Neil Schemenauer 48c7034454 Add get_referents function. Closes SF patch #402925. 2001-08-09 15:38:31 +00:00
Martin v. Löwis f9836ba4fe Put conditional S_ISDIR definition(s) into pyport.h. 2001-08-08 10:28:06 +00:00
Tim Peters fe71f81367 Part of SF patch [#431848] mathmodule.c: doc strings & conversion, from
Peter Schneider-Kamp.
Clarified some docstrings in the spirit of the patch; left out the
degrees() and radians() functions (see the patch comments on SF).
2001-08-07 22:10:00 +00:00
Guido van Rossum 528b7eb0b0 - Rename PyType_InitDict() to PyType_Ready().
- Add an explicit call to PyType_Ready(&PyList_Type) to pythonrun.c
  (just for the heck of it, really -- we should either explicitly
  ready all types, or none).
2001-08-07 17:24:28 +00:00
Jack Jansen f249addeed Got rid of (hopefully) the last 68k-mac related ifdefs. 2001-08-07 15:32:37 +00:00
Martin v. Löwis bcf4b35871 Add more constants. Contributed by itojun. 2001-08-04 22:37:23 +00:00
Martin v. Löwis 864e9ffb14 Auto-detect hstrerror. Raise socket.herror in PyH_Error. Register the three
exception classes in the module dictionary.
2001-08-04 22:32:03 +00:00
Martin v. Löwis ae26dc23a9 Do not use the system getaddrinfo on Mac OS X. Fixes bug #445928.
Since getnameinfo is not implemented, remove __APPLE__ check here.
2001-08-03 10:02:29 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
Fred Drake 52d55a3926 Cleaned up the docstring for readline.set_completer().
Thanks to Nathaniel Gray for reporting the confusion.
2001-08-01 21:44:14 +00:00
Marc-André Lemburg 03d1b1814b Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 and
add another use case to the socketmodule.
2001-07-31 18:05:33 +00:00
Martin v. Löwis 0b8de98f08 Temporarily work around bug #445928: Force usage of getaddrinfo emulation
code on Darwin, since the C library version of that seems to be broken.
2001-07-30 16:52:55 +00:00
Tim Peters 9544fc5027 Squash compiler wng about mixing signed and unsigned in comparison. 2001-07-28 09:36:36 +00:00
Guido van Rossum 702d08ec05 Fix buffer_info() docstring to match reality. See SF bug #444842. 2001-07-27 16:05:32 +00:00
Martin v. Löwis 4f1cd8bdcb Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
Thomas Wouters 7aeb6ef941 Use HAVE_SNPRINTF, not HAVE_SPRINTF, for checking the availability of
snprintf.
2001-07-24 11:03:34 +00:00
Martin v. Löwis 791bfda2b3 Autocheck for snprintf, and use sprintf if it is not available.
Remove declaration of h_errno, since it is supposedly declared in netdb.h.
Changes proposed by itojun.
2001-07-24 06:33:08 +00:00
Neil Schemenauer 7d4bb9f179 Add -E command line switch (ignore environment variables like PYTHONHOME
and PYTHONPATH).
2001-07-23 16:30:27 +00:00
Martin v. Löwis fe36fc91ed Before declaring h_errno, do not check for Win32 only. Instead, do check
whether h_errno is a macro.
2001-07-23 07:27:16 +00:00
Martin v. Löwis 9db2f571c3 Instead of accessing ss_family, cast sockaddr_storage to sockaddr and access sa_family. 2001-07-23 01:30:10 +00:00
Martin v. Löwis c7cdc63755 Set ai_addrlen even if there is no sa_len. 2001-07-21 18:48:56 +00:00
Martin v. Löwis 2d8d4276c6 Patch #401196: IPv6 extensions to the socket module.
New functions getnameinfo, getaddrinfo. New exceptions socket.gaierror,
socket.herror. Various new constants, in particular AF_INET6 and error
codes and parameters for getaddrinfo.
AF_INET6 support in setipaddr, makesockaddr, getsockaddr, getsockaddrlen,
gethost_common, PySocket_gethostbyaddr.
2001-07-21 18:05:31 +00:00
Martin v. Löwis c925b1538a Silence warnings in MSVC++: hide unused variables, add constness back to
inet_pton/ntop, convert htons argument to u_short.
2001-07-21 09:42:15 +00:00
Fred Drake dff3a37afd Make more warnings go away on the SGI compiler.
This is part of SF patch #424992.
2001-07-19 21:29:49 +00:00
Fred Drake e5065290e7 Clean up some warnings from the SGI compiler.
This is part of SF patch #434992.
2001-07-19 21:16:41 +00:00
Fred Drake 6a16ea07b8 Kill a warning on the SGI compiler.
This is part of SF patch #434992.
2001-07-19 21:11:13 +00:00
Fred Drake 0368bc44e8 Remove warnings from the SGI compiler.
This is part of SF patch #434992.
2001-07-19 20:48:32 +00:00
Fred Drake 78bdb9bc46 Elaborate a comment. 2001-07-19 20:17:15 +00:00
Martin v. Löwis d783041a14 Port getaddrinfo to MSVC++. 2001-07-19 17:37:46 +00:00
Tim Peters 3dac559299 SF bug #442520: test_struct fails on SPARC.
The ob_sval member of a string object isn't necessarily aligned to better
than a native long, so the new "q" and "Q" struct codes can't get away w/
casting tricks on platforms where LONG_LONG requires stricter-than-long
alignment.  After I thought of a few elaborate workarounds, Guido bashed
me over the head with the obvious memcpy approach, herewith implemented.
2001-07-18 20:47:31 +00:00
Guido van Rossum 36002d7af1 Add "help" to the things one is encouraged to type for more
information.  (I found this idea in the ActivePython 2.1 diffs.)
2001-07-18 16:59:46 +00:00
Fred Drake 78b71c2ad3 On Windows, tempnam() is spelled with a leading underscore. 2001-07-17 20:37:36 +00:00
Fred Drake c2683ddb29 The syntax trees handled by this module are not "abstract," so take the
"A" out of the internal abbreviations.  For published functions with
"ast" in their names, make alternate offerings using just "st".
2001-07-17 19:32:05 +00:00
Fred Drake 2c7a6851ed Remove code to initialize globals that are never used.
Add some casts to quiet warnings from an unspecified non-GCC compiler.

This closes SF patch #436258.
2001-07-17 18:34:03 +00:00
Fred Drake 02126f20b6 Add support for yield statements.
(Should be merged with descr branch.)
2001-07-17 02:59:15 +00:00
Jack Jansen 84c10b13bb File handlers don't work on the mac, so don't pretend they do. I guess this is a 2.1.1 candidate, if it isn't too late for that. 2001-07-16 19:32:52 +00:00
Thomas Wouters 1baac7201e Fix SF #441664: Python crash on del of a slice of a mmap
Check for slice/item deletion, which calls slice/item assignment with a NULL
value, and raise a TypeError instead of coredumping. Bugreport and suggested
fix by Alex Martelli.
2001-07-16 15:47:36 +00:00
Tim Peters 5ba5866281 Part way to allowing "from __future__ import generators" to communicate
that info to code dynamically compiled *by* code compiled with generators
enabled.  Doesn't yet work because there's still no way to tell the parser
that "yield" is OK (unlike nested_scopes, the parser has its fingers in
this too).
Replaced PyEval_GetNestedScopes by a more-general
PyEval_MergeCompilerFlags.  Perhaps I should not have?  I doubted it was
*intended* to be part of the public API, so just did.
2001-07-16 02:29:45 +00:00
Tim Peters 045ca7ae72 Remove redundant include of assert.h. 2001-07-15 19:42:03 +00:00
Tim Peters 0d5dd68692 Python.h: Don't attempt to redefine NDEBUG if it's already defined.
Others:  Remove redundant includes of assert.h.
2001-07-15 18:38:47 +00:00
Andrew M. Kuchling 737fbb340e [Bug #438050]
Include sys/poll.h if it was found by the configure script.  The OpenGroup
   spec says poll.h is the correct header file to use, so that file is
   preferred.
2001-07-14 20:54:37 +00:00
Andrew M. Kuchling 5a76c44181 Fix bug #417212: "curses.newwin can return pads" by changing the Python
newwin() wrapper to always return a window, and never a pad.  This makes
   the code match the documentation.
2001-07-14 20:38:30 +00:00
Thomas Wouters e38b2f1f00 Re-do the broken-nice() patch to break less platforms. Hopefully none :P
Also note that it isn't just Linux nice() that is broken: at least FreeBSD
and BSDI also have this problem. os.nice() should probably just be emulated
using getpriority()/setpriority(), if they are available, but I'll get to
that later.
2001-07-11 22:35:31 +00:00
Thomas Wouters c2c12dc31c Patch #439995 (slightly modified from the uploaded version):
Work around Linux's nonstandard nice() systemcall, which does not return the
new priority.

This closes SF bug #439990.
2001-07-11 14:45:34 +00:00
Guido van Rossum 353ae58964 SF Patch #432457 by Jason Tishler: support for readline 4.2.
This patch allows the readline module to build cleanly with GNU
readline 4.2 without breaking the build for earlier GNU readline
versions.  The configure script checks for the presence of
rl_completion_matches in libreadline.
2001-07-10 16:45:32 +00:00
Tim Peters 06e415fe52 initregex(): this function is declared void, so the recent change to
return NULL in an error case was itself an error.
2001-07-09 18:15:38 +00:00
Thomas Wouters 4ccf119053 initregex(): Check return value of PyErr_Warn() and propagate the exception
(if any.)
2001-07-09 10:45:31 +00:00
Fredrik Lundh 2d96f11d07 map re.sub() to string.replace(), when possible 2001-07-08 13:26:57 +00:00
Fredrik Lundh d89a2e7731 bug #416670
added copy/deepcopy support to SRE (still not enabled, since it's not
covered by the test suite)
2001-07-03 20:32:36 +00:00
Fredrik Lundh ee2f18d0ee bug #232815
ch is unsigned, so testing for negative values doesn't make
sense (as noticed by the OpenVMS compiler)
2001-07-03 19:27:05 +00:00
Fredrik Lundh df781e6a3f reapplied darryl gallion's minimizing repeat fix. I'm still not 100%
sure about this one, but test #133283 now works even with the fix in
place, and so does the test suite.  we'll see what comes up...
2001-07-02 19:54:28 +00:00
Fredrik Lundh f71ae461bf pythonware repository roundtrip (untabification) 2001-07-02 17:04:48 +00:00
Fredrik Lundh 19af43d78a added martin's BIGCHARSET patch to SRE 2.1.1. martin reports 2x
speedups for certain unicode character ranges.
2001-07-02 16:58:38 +00:00
Fredrik Lundh b0f05bdfd3 merged with pythonware's SRE 2.1.1 codebase 2001-07-02 16:42:49 +00:00
Fredrik Lundh 8f4558583f use Py_UNICODE_WIDE instead of USE_UCS4_STORAGE and Py_UNICODE_SIZE
tests.
2001-06-27 18:59:43 +00:00
Tim Peters 208efe5640 Windows build broke from recent Unicode changes -- need to #define
SIZEOF_SHORT by hand here.
Also added dynamic check that SIZEOF_SHORT is correct for the platform (in
_testcapimodule).
2001-06-26 22:40:47 +00:00
Fredrik Lundh 1294ad0c59 experimental UCS-4 support: added USE_UCS4_STORAGE define to
unicodeobject.h, which forces sizeof(Py_UNICODE) == sizeof(Py_UCS4).
(this may be good enough for platforms that doesn't have a 16-bit
type.  the UTF-16 codecs don't work, though)
2001-06-26 17:17:07 +00:00
Fredrik Lundh 3083163dc1 experimental UCS-4 support: don't assume that MS_WIN32 implies
HAVE_USABLE_WCHAR_T
2001-06-26 15:11:00 +00:00
Martin v. Löwis 51777ce758 Remove const-ness in inet_pton declaration. 2001-06-25 06:38:03 +00:00
Martin v. Löwis 2b110f9713 Replace snprintf with sprintf. 2001-06-25 06:37:02 +00:00
Martin v. Löwis a2ca1ae3ca Fix typos in inet_pton/inet_ntop. 2001-06-24 21:35:43 +00:00
Martin v. Löwis a45ecae474 Provide a definition for offsetof. 2001-06-24 21:28:42 +00:00
Martin v. Löwis b9ab159052 Emulate inet_{pton,ntop} on systems that don't provide it. 2001-06-24 21:18:26 +00:00
Tim Peters 7e82b9cc6b Pure brute-force hackery to allow Python to build on Windows again,
because I need to make progress and don't have time now to think about
whatever it is the new code is trying to accomplish.
2001-06-24 05:08:52 +00:00
Martin v. Löwis bfdf4ecad0 Properly use &&. Closes bug #434988. 2001-06-23 19:58:46 +00:00
Martin v. Löwis b28f6e7c7b Properly use &&. Closes bug #434989. 2001-06-23 19:55:38 +00:00
Martin v. Löwis 01dfdb3d35 Patch #401196: Configuration machinery for IPv6.
Contributed by Jun-ichiro "itojun" Hagino. get{addr,name}info emulation
code taken from WIDE.
2001-06-23 16:30:13 +00:00
Andrew M. Kuchling 888aa26819 [Bug #433047, reported by Armin Rigo] Remove extra 'i' character in
PyArg_ParseTuple() call.

(2.1.1 bugfix candidate.)
2001-06-18 19:04:04 +00:00
Marc-André Lemburg 4157dd5a92 Fix for bug [ #433047 ] missing args to PyArg_ParseTuple 2001-06-17 18:32:36 +00:00
Tim Peters 83c9edc05c Fix error in comment, and in test_long_api and test_longlong_api remove
the need for the F_ERROR macro.
2001-06-16 08:10:13 +00:00
Thomas Wouters 2b30524ea9 Forward-port revision 2.24.2.4 from the release21-maint branch:
Protect several more uses of constants with #ifdefs; these are necessary on
(at least) SCO OpenServer 5. Fixes a non-SF-submitted bugreport by Michael
Kent.
2001-06-15 12:05:44 +00:00
Tim Peters ff70d3c8d4 Fixed typo in comment. 2001-06-14 01:11:03 +00:00
Tim Peters e7c1f9b822 Add tests of PyLong_{As,From}{Unsigned,}Long. These are very much like
the new PyLong_{As,From}{Unsigned,}LongLong tests, so the bulk of the
code is in the new #include file testcapi_long.h, which generates
different code depending on how macros are set.  This sucks, but I couldn't
think of anything that sucked less.

UNIX headache?  If we still maintain dependencies by hand, someone who
knows what they're doing should teach whatever needs it that
_testcapimodule.c includes testcapi_long.h.
2001-06-14 00:55:41 +00:00
Tim Peters da9c5b35a3 The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL.
Repaired that, and added appropriate tests for it to test_struct.py.
2001-06-13 01:26:35 +00:00
Tim Peters d1a7da6c0d longobject.c:
Replaced PyLong_{As,From}{Unsigned,}LongLong guts with calls
    to _PyLong_{As,From}ByteArray.
_testcapimodule.c:
    Added strong tests of PyLong_{As,From}{Unsigned,}LongLong.

Fixes SF bug #432552 PyLong_AsLongLong() problems.
Possible bugfix candidate, but the fix relies on code added to longobject
to support the new q/Q structmodule format codes.
2001-06-13 00:35:57 +00:00
Tim Peters 91621dbcbe The merest start of a test for the PyLong_{As,From}{Unsigned,}LongLong()
functions.  I intend to replace their guts with calls to the new
_PyLong_{As,From}ByteArray() functions, but AFAICT there's no tests for
them at all now; I also suspect PyLong_AsLongLong() isn't catching all
overflow cases, but without a std test to demonstrate that why should you
believe me <wink>.

Also added a raiseTestError() utility function.
2001-06-12 20:10:01 +00:00
Marc-André Lemburg da4dbc36c1 Removed the Python version from the PYTHONHOMEHELP string. It was
still set to python2.0 ...
2001-06-12 16:13:51 +00:00
Tim Peters 7a3bfc3a47 Added q/Q standard (x-platform 8-byte ints) mode in struct module.
This completes the q/Q project.

longobject.c _PyLong_AsByteArray:  The original code had a gross bug:
the most-significant Python digit doesn't necessarily have SHIFT
significant bits, and you really need to count how many copies of the sign
bit it has else spurious overflow errors result.

test_struct.py:  This now does exhaustive std q/Q testing at, and on both
sides of, all relevant power-of-2 boundaries, both positive and negative.

NEWS:  Added brief dict news while I was at it.
2001-06-12 01:22:22 +00:00
Tim Peters 2d4e077f23 Trimmed trailing whitespace. 2001-06-11 16:57:33 +00:00
Tim Peters 3023f78819 Simplify some convolution by simply not recognizing 'q' and 'Q' at all
in native mode on platforms that don't HAVE_LONG_LONG.
2001-06-11 16:51:56 +00:00
Tim Peters be80085514 Make clear in the docstring that "std" applies to both size and alignment,
not just to alignment.  Spotted by Guido.

Bugfix candidate.
2001-06-11 16:45:33 +00:00
Thomas Wouters 819bb2c502 Protect the use of the VWERASE symbol by an #ifdef, it's apparently missing
on (some versions of ?) AIX.
2001-06-11 15:25:16 +00:00
Tim Peters 7b9542a3f7 Initial support for 'q' and 'Q' struct format codes: for now, only in
native mode, and only when config #defines HAVE_LONG_LONG.  Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).

test_struct.py:  In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).

libstruct.tex:  In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.
2001-06-10 23:40:19 +00:00
Peter Schneider-Kamp 07c1922b12 annoying whitespace inconsistency 2001-06-10 16:45:08 +00:00
Peter Schneider-Kamp d895b20da0 This closes bug #430849 (internal error produced by binascii.a2b_base64) 2001-06-07 05:51:36 +00:00
Tim Peters b870c75253 Make it possible to find the use of tp_as_buffer here with a global search.
(Just a change to a comment)
2001-06-05 04:43:26 +00:00
Neil Schemenauer 89e90d67aa Separate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor
directives, which is the role of CPPFLAGS.  Closes SF patch #414991.
2001-06-02 06:16:02 +00:00
Tim Peters 4324aa3572 Cruft cleanup: Removed the unused last_is_sticky argument from the internal
_PyTuple_Resize().
2001-05-28 22:30:08 +00:00
Guido van Rossum c8555b38e7 Iterator support: made the xreadlines object its own iterator. This
ought to be faster.
2001-05-22 16:41:32 +00:00
Fred Drake d0b625d05a Correct the sense of a couple of conditional compilations -- used #ifndef
when #ifdef was needed.

This closes (reallu!) SF bug #417418.
2001-05-22 15:44:15 +00:00
Fred Drake 7b87f85c78 Add :method info to the PyArg_ParseTuple() format strings for poll objects. 2001-05-21 03:29:05 +00:00
Guido van Rossum 2e0a654f6e Add warnings to the strop module, for to those functions that really
*are* obsolete; three variables and the maketrans() function are not
(yet) obsolete.

Add a compensating warnings.filterwarnings() call to test_strop.py.

Add this to the NEWS.
2001-05-15 02:14:44 +00:00
Tim Peters d401eddf91 Fix new compiler warnings. Also boost "start" from (C) int to long and
return a (C) long:  PyArg_ParseTuple and Py_BuildValue may not let us get
at the size_t we really want, but C int is clearly too small for a 64-bit
box, and both the start parameter and the return value should work for
large mapped files even on 32-bit boxes.  The code really needs to be
rethought from scratch (not by me, though ...).
2001-05-14 23:19:12 +00:00
Tim Peters 58e0a8c130 SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. 2001-05-14 22:32:33 +00:00
Fred Drake 460f0691df fcntl.ioctl(): Update error message; necessity noted by Michael Hudson. 2001-05-14 21:02:36 +00:00
Mark Hammond 26cffde4c2 Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule. 2001-05-14 12:17:34 +00:00
Greg Stein 834f4dd7c9 Fix the .find() method for memory maps.
1) it didn't obey the "start" parameter (and when it does, we must validate
   the value)
2) the return value needs to be an absolute index, rather than relative to
   some arbitrary point in the file

(checking CVS, it appears this method never worked; these changes bring it
 into line with typical .find() behavior)
2001-05-14 09:32:26 +00:00
Mark Hammond ef8b654bbe Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. 2001-05-13 08:04:26 +00:00
Fred Drake 564a6cc8ca Fix a minor style consistency issue.
When getting a string buffer for a string we just created, use
PyString_AS_STRING() instead of PyString_AsString() to avoid the
call overhead and extra type check.
2001-05-11 20:12:26 +00:00
Fred Drake 87068f1eaa Include sys/modem.h if we have it; this is needed on HP-UX to provide
constants used by other macros from the headers.

Conditionalize VREPRINT and VDISCARD; these are not available on HP-UX.

This closes bug #417418.
2001-05-11 16:14:17 +00:00
Fred Drake 1d531997a6 Fix the fcntl() docstring so the user is not mis-directed to the FCNTL
module for useful constants.
2001-05-10 15:54:32 +00:00
Tim Peters 1ee77d9b71 Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as
meaning infinity -- but at least warn about it in the code!  I pissed
away a couple hours on this today, and don't wish the same on the next
in line.
Bugfix candidate.
2001-05-10 01:23:39 +00:00
Tim Peters da45d55a6e The strop module and test_strop.py believe replace() with a 0 count
means "replace everything".  But the string module, string.replace()
amd test_string.py believe a 0 count means "replace nothing".
"Nothing" wins, strop loses.
Bugfix candidate.
2001-05-10 00:59:45 +00:00
Tim Peters 9c012af3c3 Heh. I need a break. After this: stropmodule & stringobject were more
out of synch than I realized, and I managed to break replace's "count"
argument when it was 0.  All is well again.  Maybe.
Bugfix candidate.
2001-05-10 00:32:57 +00:00
Tim Peters 4cd44ef4bf Fudge. stropmodule and stringobject both had copies of the buggy
mymemXXX stuff, and they were already out of synch.  Fix the remaining
bugs in both and get them back in synch.
Bugfix release candidate.
2001-05-10 00:05:33 +00:00
Tim Peters 1a7b3eee94 SF bug #422088: [OSF1 alpha] string.replace().
Platform blew up on "123".replace("123", "").  Michael Hudson pinned the
blame on platform malloc(0) returning NULL.
This is a candidate for all bugfix releases.
2001-05-09 23:00:26 +00:00
Tim Peters 0f8b494df6 Mechanical changes for easier edits. 2001-05-09 22:15:03 +00:00
Fred Drake 152a25ee1c Modify to allow file objects wherever file descriptors are needed.
This closes SF bug #231328.

Added all constants needed to use the functions defined in this module
that are not defined elsewhere (the O_* symbols are available in the
os module).  No additonal modules are needed to use this now.
2001-05-09 21:02:02 +00:00
Fred Drake c99ff60573 fdconv(): Do not second guess the error condition returned by
PyObject_AsFileDescriptor() -- it does the same thing everywhere, so
    use it the same way everyone else does so that exceptions are
    consistent.  This means we have less code here, and we do not need to
    resort to hackish ways of getting the Python-visible function name to
    fdconv().
2001-05-09 20:14:09 +00:00
Fred Drake fd16834ca7 Three uses of makesockaddr() used sockaddr buffers that had not be cleared;
this could cause invalid paths to be returned for AF_UNIX sockets on some
platforms (including FreeBSD 4.2-RELEASE), appearantly because there is
no assurance that the address will be nul-terminated when filled in by the
kernel.

PySocketSock_recvfrom():  Use PyString_AS_STRING() to get the data pointer
    of a string we create ourselves; there is no need for the extra type
    check from PyString_AsString().

This closes SF bug #416573.
2001-05-09 19:11:33 +00:00
Tim Peters d6283b84c8 Minor fiddling related to
SF patch 416251 2.1c1 mmapmodule: unused vrbl cleanup
2001-05-09 18:48:26 +00:00
Fred Drake b2877dd122 Only import termio.h on OSF, and add a comment about why it is needed there.
This header does not exist on all Unix flavors; FreeBSD in particular does
not include it.

This closes SF bug #422320.
2001-05-09 17:53:06 +00:00
Fred Drake b638aafef2 Michael Hudson <mwh21@cam.ac.uk>:
This patch does several things to termios:

(1) changes all functions to be METH_VARARGS
(2) changes all functions to be able to take a file object as the
    first parameter, as per

http://mail.python.org/pipermail/python-dev/2001-February/012701.html

(3) give better error messages
(4) removes a bunch of comments that just repeat the docstrings
(5) #includes <termio.h> before #including <sys/ioctl.h> so more
    #constants are actually #defined.
(6) a couple of docstring tweaks

I have tested this minimally (i.e. it builds, and
doesn't blow up too embarassingly) on OSF1/alpha and
on one of the sf compile farm's solaris boxes, and
rather more comprehansively on my linux/x86 box.

It still needs to be tested on all the other platforms
we build termios on.


This closes the code portion of SF patch #417081.
2001-05-07 17:55:35 +00:00
Fred Drake 9b03e59deb Remove an obsolete comment and a "return" before fallig off the end of a
void function.
2001-05-03 16:05:46 +00:00
Fred Drake cde79131ea ParserCreate(): Allow an empty string for the namespace_separator argument;
while not generally a good idea, this is used by RDF users, and works
    to implement RDF-style namespace+localname concatenation as defined
    in the RDF specifications.  (This also corrects a backwards-compatibility
    bug.)

Be more conservative while clearing out handlers; set the slot in the
self->handlers array to NULL before DECREFing the callback.

Still more adjustments to make the code style internally consistent.
2001-04-25 16:01:30 +00:00
Tim Peters cf96de052f SF but #417587: compiler warnings compiling 2.1.
Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported.
2001-04-21 02:46:11 +00:00
Jeremy Hylton 43454765c2 Export three optimization (fast locals) flags 2001-04-16 18:42:13 +00:00
Guido van Rossum 13324e1e1f Reverting Moshe's EGD patch *and* Martin's patch to make it work with
OpenSSL versions beore 0.9.5.  This just is too experimental to be
worth it, especially since the user would have to do some severe
hacking of the Modules/Setup file to even enable the EGD code, and
without the EGD code it would always spit out a warning on some
systems -- even when socket.ssl() is not used.  Fixing that properly
is not my job; the EGD patch is clearly not so important that it
should hold up the 2.1 release.
2001-04-16 00:21:33 +00:00
Fredrik Lundh 9c7eab82b3 SRE: made "copyright" string static, to avoid potential linking
conflicts.
2001-04-15 19:00:58 +00:00
Guido van Rossum f68d8e52e7 Make some private symbols static. 2001-04-14 17:55:09 +00:00
Guido van Rossum b0e51b2957 Clean up the unsightly mess around the readline header files. We now
always:

- #undef HAVE_CONFIG_H (because otherwise chardefs.h tries to include
  strings.h)

- #include readline.h and history.h

and we never declare any readline function prototypes ourselves.

This makes it compile with readline 4.2, albeit with a few warnings.
Some of the remaining warnings are about completion_matches(), which
is renamed to rl_completion_matches().

I've tested it with various other versions, from 2.0 up, and they all
seem to work (some with warnings) -- but only on Red Hat Linux 6.2.

Fixing the warnings for readline 4.2 would break compatibility with
3.0 (and maybe even earlier versions), and readline doesn't seem to
have a way to test for its version at compile time, so I'd rather
leave the warnings in than break compilation with older versions.
2001-04-13 18:14:27 +00:00
Guido van Rossum 058dae37a6 I am TENTATIVELY checking in Martin von Loewis's patch for the SSL
problem reported by Neil Schemenauer on python-dev on 4/12/01, wth
subject "Problem with SSL and socketmodule on Debian Potato?".

It's tentative because Moshe objected, but Martin rebutted, and Moshe
seems unavailable for comments.

(Note that with OpenSSL 0.9.6a, I get a lot of compilation warnings
for socketmodule.c -- I'm assuming I can safely ignore these until 2.1
is released.)
2001-04-13 17:54:04 +00:00
Fred Drake 2a5a5ca012 cleanup_helper(): Make sure we invalidate all reference objects
before calling any callbacks.  This is important
                   since the callback objects only look at themselves
                   to determine that they are invalide.  This change
                   avoids a segfault when callbacks use a different
                   reference to an object in the process of being
                   deallocated.

This fixes SF bug #415660.
2001-04-13 17:15:47 +00:00
Guido van Rossum eb0d992520 Slight adaptation of Michael Hudson's patch to test PyDict_Next()
(with modification of existing dict elements!).

This is part of SF patch #409864: lazy fix for Pings bizarre scoping
crash.

The adaptation I made to Michael's patch was to change the error
handling to avoid masking other errors (moving the specific error
message to inside test_dict_inner()), and to insert a test for
dict==NULL at the start.
2001-04-13 17:08:15 +00:00
Guido van Rossum 2242f2fbd0 Unixware 7 support by Billy G. Allie (SF patch 413011) 2001-04-11 20:58:20 +00:00
Guido van Rossum bceccf5f43 Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger 2001-04-10 22:07:43 +00:00
Guido van Rossum 858ca0f229 Include py_curses.h *after* defining _XOPEN_SOURCE_EXTENDED.
Michael Hudson suggested this fox for the Tru64 problem (SF bug
232597).  It looks reasonable, it works on Tru64, and it doesn't beak
anything on Linux, so I say go for it.
2001-04-10 19:53:37 +00:00
Tim Peters d8ae7c2999 Ack -- this module mixes tabs and spaces, and what appears to be a mix
of 2-space and 4-space indents.  Whatever, when I saw the checkin diff it
was clear that what my editor thinks a tab means didn't match this module's
belief.  Removed all the tabs from the lines I added and changed, left
everything else alone.
2001-04-10 04:35:28 +00:00
Tim Peters 3906eb877a On a sizeof(long)==8 machine, ints in range(2**31, 2**32) were getting
pickled into the signed(!) 4-byte BININT format, so were getting unpickled
again as negative ints.  Repaired that.
Added some minimal docs at the top about what I've learned about the pickle
format codes (little of which was obvious from staring at the code,
although that's partly because all the size-related bugs greatly obscured
the true intent of the code).
Happy side effect:  because save_int() needed to grow a *proper* range
check in order to fix this bug, it can now use the more-efficient BININT1,
BININT2 and BININT formats when the long's value is small enough to fit
in a signed 4-byte int (before this, on a sizeof(long)==8 box it always
used the general INT format for negative ints).
test_cpickle works again on sizeof(long)==8 machines.  test_pickle is
still busted big-time.
2001-04-10 04:22:00 +00:00
Tim Peters bfa18f711f Critical fix: if cPickle on a sizeof(long)==8 box is used to read a
binary pickle, and the latter contains a pickle of a negative Python
int i written on a sizeof(long)==4 box (and whether by cPickle or
pickle.py), it's read incorrectly as i + 2**32.  The patch repairs that,
and allows test_cpickle.py (to which I added a relevant test case earlier
today) to work again on sizeof(long)==8 boxes.
There's another (at least one) sizeof(long)==8 binary pickle bug, but in
pickle.py instead.  That bug is still there, and test_pickle.py doesn't
catch it yet (try pickling and unpickling, e.g., 1 << 46).
2001-04-10 01:54:42 +00:00
Fred Drake 29fd0317ba Michael Hudson <mwh21@cam.ac.uk>:
Update the docstrings to no longer refer to the obsolete TERMIOS
module.

This is a partial acceptance of SF patch #413419.
2001-04-09 19:32:52 +00:00
Tim Peters f0e717bdb1 Repair portability of sign extension when reading signed ints on boxes
where sizeof(long)==8.  This *was* broken on boxes where signed right
shifts didn't sign-extend, but not elsewhere.  Unfortunately, apart
from the Cray T3E I don't know of such a box, and Guido has so far
refused to buy me any Cray machines for home Python testing <wink>.

More immediately interesting would be if someone could please test
this on *any* sizeof(long)==8 box, to make sure I didn't break it.
2001-04-08 23:39:38 +00:00
Fred Drake d3908e2952 Effectively revert the previous change: leave the new #include in, but
comment it out with an explanation.  This makes it easier for someone
who wants the additional symbols to try re-enabling it for their platform.
2001-04-05 18:26:31 +00:00
Fred Drake 9b3bc49575 Add an #include of sys/ioctl.h to pick up a lot of the constants supported
in the previous patch.

This closes (again!) SF patch #410267.
2001-04-04 21:19:26 +00:00
Guido van Rossum f5bd684337 Applying SF patch #412553 by Christopher Lee: fix linuxaudiodev
handling of EAGAIN.

This may or may not fix the problem for me (Mandrake 7.2 on a Dell
Optiplex GX110 desktop): I can't hear the output, but it does pass the
test now.  It doesn't fix the problem for Fred (Mandrake 7.2 on a Dell
Inspiron 7500 which has the Maestro sound drivers).  Fred suspects
that it's the kernel version in combination with the driver.
2001-04-02 17:59:02 +00:00
Fred Drake 55a0034682 Michael Hudson <mwh21@cam.ac.uk>:
Add many more constants for some systems.

This closes SF patch #410267.
2001-03-26 17:14:02 +00:00
Fred Drake 4113b137cd get_version_string(): New function -- returns a Python string object that
gives the CVS revision of this file even if it does not include the
    extra RCS "$Revision: " cruft.

initpyexpat():  Use get_version_string() instead of hard-coding magic
    indexes into the RCS string (which may be affected by export options).
2001-03-24 19:58:26 +00:00
Guido van Rossum 9dee48f6e7 Fix a memory leak -- there's no need to INCREF() the result of
newreadlinesobject() in xreadlines().
2001-03-23 18:30:19 +00:00
Tim Peters a5d7b748d9 Revert the 1.8 patch, since it's implicated in nasty blowups (see Pyhon-Dev). 2001-03-23 06:14:28 +00:00
Jeremy Hylton 8bf395f1aa add DEF_BOUND constant 2001-03-22 23:10:44 +00:00
Guido van Rossum 8652522442 Update the Tix version (long overdue :-).
This is SF patch # #409044, by Internet Discovery: "Update tcl/tk/tix
versions".
2001-03-22 22:18:55 +00:00
Fred Drake 82f1480d63 Inform the cycle-detector that the a weakref object no longer needs to be
tracked as soon as it is clear; this can decrease the number of roots for
the cycle detector sooner rather than later in applications which hold on
to weak references beyond the time of the invalidation.
2001-03-22 18:05:30 +00:00
Fred Drake 2c77355937 Make cPickle use the recently-added PyInstance_NewRaw() API to create
instance objects without calling the constructor.  This is the same as
the new.instance() function.
2001-03-22 17:52:17 +00:00
Fredrik Lundh b25e1ad253 sre 2.1b2 update:
- take locale into account for word boundary anchors (#410271)
- restored 2.0's *? behaviour (#233283, #408936 and others)
- speed up re.sub/re.subn
2001-03-22 15:50:10 +00:00
Jeremy Hylton bc32024769 Extend support for from __future__ import nested_scopes
If a module has a future statement enabling nested scopes, they are
also enable for the exec statement and the functions compile() and
execfile() if they occur in the module.

If Python is run with the -i option, which enters interactive mode
after executing a script, and the script it runs enables nested
scopes, they are also enabled in interactive mode.

XXX The use of -i with -c "from __future__ import nested_scopes" is
not supported.  What's the point?

To support these changes, many function variants have been added to
pythonrun.c.  All the variants names end with Flags and they take an
extra PyCompilerFlags * argument.  It is possible that this complexity
will be eliminated in a future version of the interpreter in which
nested scopes are not optional.
2001-03-22 02:47:58 +00:00
Guido van Rossum ec24c1bc32 Don't raise MemoryError in keys() when the database is empty.
This fixes SF bug #410146 (python 2.1b shelve is broken).
2001-03-22 00:19:22 +00:00
Tim Peters 26ae7cd75a SF patch 407758, "timemodule patches for Cygwin", from Norman Vine.
http://sourceforge.net/tracker/?func=detail&aid=407758&group_id=5470&atid=305470
2001-03-20 03:26:49 +00:00
Moshe Zadka 8f4eab2345 Committing patch 405101 2001-03-18 17:11:56 +00:00
Tim Peters 84e87f379e SF bug [ #233200 ] cPickle does not use Py_BEGIN_ALLOW_THREADS.
http://sourceforge.net/tracker/?func=detail&aid=233200&group_id=5470&atid=105470
Wrapped the fread/fwrite calls in thread BEGIN_ALLOW/END_ALLOW brackets
Afraid I hit the "delete trailing whitespace key" too!  Only two "real" sections
of code changed here.
2001-03-17 04:50:51 +00:00
Jeremy Hylton 30c9f3991c Variety of small INC/DECREF patches that fix reported memory leaks
with free variables.  Thanks to Martin v. Loewis for finding two of
the problems.  This fixes SF buf 405583.

There is also a C API change: PyFrame_New() is reverting to its
pre-2.1 signature.  The change introduced by nested scopes was a
mistake.  XXX Is this okay between beta releases?

cell_clear(), the GC helper, must decref its reference to break
cycles.

frame_dealloc() must dealloc all cell vars and free vars in addition
to locals.

eval_code2() setup code must INCREF cells it copies out of the
closure.

The STORE_DEREF opcode implementation must DECREF the object it passes
to PyCell_Set().
2001-03-13 01:58:22 +00:00
Fred Drake 8e68eb61f2 Make sure we close the group and password databases when we are done with
them; this closes SF bug #407504.
2001-03-11 03:03:07 +00:00
Martin v. Löwis c4db476c87 Define sunmath prototypes if sunmath.h was not included. 2001-03-07 10:22:20 +00:00
Martin v. Löwis f58de1bd67 Document SIG_* warning causes on Solaris. 2001-03-06 12:13:56 +00:00
Martin v. Löwis 2b6727bd8a Use Py_CHARMASK for ctype macros. Fixes bug #232787. 2001-03-06 12:12:02 +00:00
Fred Drake f585bef504 Be a bit more strict in setting up the export of the C API for this
module; do not attempt to insert the API object into the module dict
if there was an error creating it.
2001-03-03 19:41:55 +00:00
Fred Drake d85556c663 Wrap several more of the constants in #ifdef/#endif for FreeBSD; at least
some fairly recent versions have an anaemic selection of terminal-control
symbols.

This closes SF bug #405567.
2001-03-03 18:08:52 +00:00
Guido van Rossum ad2c3c7b69 Extra fix from bbum (SF #402357) for his previous patch:
It should use the normal CC referenced compiler as ObjC is integrated
  directly into gcc and enabled through the use of the -ObjC flag.
2001-03-02 07:09:54 +00:00
Guido van Rossum 258ccd4126 Fix typo in RISCOS patch inside MS #ifdef. (Probably my own fingers.) 2001-03-02 06:53:29 +00:00
Fred Drake dedbebf9f8 Add more protection around the VSWTC/VSWTCH, CRTSCTS, and XTABS symbols;
these can be missing on some (all?) Irix and Tru64 versions.

Protect the CRTSCTS value with a cast; this can be a larger value on
Solaris/SPARC.

This should fix SF tracker items #405092, #405350, and #405355.
2001-03-02 06:50:58 +00:00
Guido van Rossum 48a680c097 RISCOS changes by dschwertberger. 2001-03-02 06:34:14 +00:00
Guido van Rossum 1ca8bb374e RISCOS changes by dschwertberger 2001-03-02 06:28:17 +00:00
Guido van Rossum 3ed4c15a88 RISCOS changes by dschwertberger. 2001-03-02 06:18:03 +00:00
Fred Drake 9ef7fa875a Solaris defines VSWTCH instead of VSWTC; carefully make sure both are
defined and export both names.

Solaris also does not define CBAUDEX; it is not clear that CBAUDEXT
(which is defined there) is the same thing, so we only protect against
the lack of CBAUDEX.

Reported by Greg V. Wilson.
2001-03-01 21:54:49 +00:00
Fred Drake bb66a200be Wrap some long lines, use only C89 /* */ comments, and add spaces around
some operators (style guide conformance).
2001-03-01 20:48:17 +00:00
Fred Drake abb379e189 Revised version of Jason Tishler's patch to make this compile on Cygwin,
which does not define all the constants.

This closes SF tracker patch #404924.
2001-03-01 03:28:08 +00:00
Tim Peters 5687ffe0c5 SF patch 404928: Support for next Cygwin gcc (2.95.2-8) 2001-02-28 16:44:18 +00:00
Fred Drake df48d14f44 Define the constants needed for working with these functions directly
in this module; no more need for TERMIOS.py.
2001-02-27 21:22:39 +00:00
Andrew M. Kuchling 6efc6e7832 Patch #404680: disables the nis module and enables the dl module when
building under Cygwin.  Makes some fixes to the dlmodule in order to
    compile with Cygwin.
2001-02-27 20:54:23 +00:00