Commit Graph

2292 Commits

Author SHA1 Message Date
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