Commit Graph

1895 Commits

Author SHA1 Message Date
Andrew M. Kuchling e365fb8d1f Use METH_VARARGS instead of numeric constant 1 in method def. tables 2000-08-03 02:06:16 +00:00
Andrew M. Kuchling 14f515844d Use METH_VARARGS instead of numeric constant 1 2000-08-03 02:04:05 +00:00
Guido van Rossum a2214c37fd Rob Hooft (Patch #101046): use PyArg_ParseTuple everywhere. 2000-08-02 20:46:51 +00:00
Andrew M. Kuchling 3b96d0b199 Fix for bug #110651 (Jitterbug PR#343): only use the low 8 bits of an octal
escape, as documented in the comment for the check_escape() function
2000-08-02 13:41:18 +00:00
Fredrik Lundh e186983842 final 0.9.8 updates:
-- added REPEAT_ONE operator
-- added ANY_ALL operator (used to represent "(?s).")
2000-08-01 22:47:49 +00:00
Fredrik Lundh 2f2c67d7e5 -- fixed width calculations for alternations
-- fixed literal check in branch operator
   (this broke test_tokenize, as reported by Mark Favas)
-- added REPEAT_ONE operator (still not enabled, though)
-- added some debugging stuff (maxlevel)
2000-08-01 21:05:41 +00:00
Tim Peters 329e29198d Removed decl of unreferenced vrbl. 2000-08-01 21:00:58 +00:00
Fredrik Lundh 29c4ba9ada SRE 0.9.8: passes the entire test suite
-- reverted REPEAT operator to use "repeat context" strategy
   (from 0.8.X), but done right this time.
-- got rid of backtracking stack; use nested SRE_MATCH calls
   instead (should probably put it back again in 0.9.9 ;-)
-- properly reset state in scanner mode
-- don't use aggressive inlining by default
2000-08-01 18:20:07 +00:00
Andrew M. Kuchling a4e9a33382 Update e-mail address 2000-08-01 01:26:02 +00:00
Peter Schneider-Kamp dc71cacc9c replaced PyArgs_Parse by PyArgs_ParseTuple
changed error messages for extend method from "append" to "extend"
2000-07-31 21:57:30 +00:00
Peter Schneider-Kamp 5a65c2d436 added count, extend, index, pop and remove to arraymodule 2000-07-31 20:52:21 +00:00
Peter Schneider-Kamp 7e01890986 merge Include/my*.h into Include/pyport.h
marked my*.h as obsolete
2000-07-31 15:28:04 +00:00
Mark Hammond 071864acb2 More Windows changes.
* After discussion with Trent, all INT_PTR references have been removed in favour of the HANDLE it should always have been.  Trent can see no 64bit issues here.

* In this process, I noticed that the close operation was dangerous, in that we could end up passing bogus results to the Win32 API.  These result of the API functions passed the bogus values were never (and still are not) checked, but this is closer to "the right thing" (tm) than before.

Tested on Windows and Linux.
2000-07-30 02:46:26 +00:00
Mark Hammond 2cbed005b6 Fixes for Windows (but also tested on Linux). Test suite now completes, and this module should not leak in the face of errors.
Checkin that replaces the INT_PTR types with HANDLEs still TBD (but as that is a "spelling" patch, rather than a functional one, I will commit it seperately.
2000-07-30 02:22:43 +00:00
Andrew M. Kuchling fb6bbf51a6 Added list of missing functions as a comment 2000-07-27 11:58:01 +00:00
Andrew M. Kuchling 8353f623d6 Comment out a debugging print (spotted by Michael Deegan) 2000-07-26 18:36:27 +00:00
Fredrik Lundh 2031893842 - changed windows pclose to make sure we don't return before the
underlying process has terminated
  (bug fix from David Bolen)
2000-07-26 17:29:12 +00:00
Jeremy Hylton 4d6381dfee Fix UCNs machine with >= 32bit longs
originally submitted by Bill Tutt

Note: This code is actually going to be replaced in 2.0 by /F's new
database.  Until then, this patch keeps the test suite working.
2000-07-26 03:56:06 +00:00
Andrew M. Kuchling 70e89c11fe Added wrappers for tiget{flag,num,str}, for querying terminfo capabilities 2000-07-26 02:57:20 +00:00
Thomas Wouters 334fb8985b Use 'void' directly instead of the ANY #define, now that all code is ANSI C.
Leave the actual #define in for API compatibility.
2000-07-25 12:56:38 +00:00
Andrew M. Kuchling bf680266da Modified version of patch #100963 from Mark Favas: has_key() is an
ncurses extension, so it's made conditional depending on STRICT_SYSV_CURSES
2000-07-25 12:37:41 +00:00
Andrew M. Kuchling 4463acbc32 Bug report and partial patch from Michael Deegan <michael@ucc.gu.uwa.edu.au>:
reversed tests resulted in an exception when you supplied the correct number
of arguments
2000-07-24 23:54:49 +00:00
Thomas Wouters c44221271a Remove unused variable and what looks like an ancient relic of an old
version of SSLeay (now known as OpenSSL.)
2000-07-24 16:26:35 +00:00
Thomas Wouters 1e0c2f4bee Create a new section of pyport.h to hold all external function declarations
for systems that are missing those declarations from system include files.
Start by moving a pointy-haired ones from their previous locations to the
new section.

(The gethostname() one, for instance, breaks on several systems, because
some define it as (char *, size_t) and some as (char *, int).)

I purposely decided not to include the summary of used #defines like Tim did
in the first section of pyport.h. In my opinion, the number of #defines
likedly to be used by this section would make such an overview unwieldy. I
would suggest documenting the non-obvious ones, though.
2000-07-24 16:06:23 +00:00
Thomas Wouters 5c669860e6 ANSIfy a bit more. 2000-07-24 15:49:08 +00:00
Thomas Wouters ed77bac472 Fix floattime prototype ((void), not (double)) 2000-07-24 15:26:39 +00:00
Thomas Wouters 58d0510245 ANSIfy some more forward declarations. 2000-07-24 14:43:35 +00:00
Thomas Wouters 4789b3ae05 ... and yet more ANSIfications... 2000-07-24 11:36:47 +00:00
Thomas Wouters 770e4042db ANSIfy yet another hidden function definition. 2000-07-24 11:26:25 +00:00
Thomas Wouters eb61b6ebb6 Fix typo in previous patch. 2000-07-24 11:17:40 +00:00
Thomas Wouters ccada2421b *** empty log message *** 2000-07-24 11:09:37 +00:00
Mark Hammond 46a733dfbf Patch #100926 - Better error messages for socket exceptions on Windows. [Slight style differences from posted patch] 2000-07-24 01:45:11 +00:00
Fredrik Lundh 8a3ebf8ca8 -- SRE 0.9.6 sync. this includes:
+ added "regs" attribute
 + fixed "pos" and "endpos" attributes
 + reset "lastindex" and "lastgroup" in scanner methods
 + removed (?P#id) syntax; the "lastindex" and "lastgroup"
   attributes are now always set
 + removed string module dependencies in sre_parse
 + better debugging support in sre_parse
 + various tweaks to build under 1.5.2
2000-07-23 21:46:17 +00:00
Tim Peters 4f1b2081e9 Removed all instances of RETSIGTYPE from the source code: signal
handlers "return void", according to ANSI C.
Removed the new Py_RETURN_FROM_SIGNAL_HANDLER macro.
Left RETSIGTYPE in the config stuff, because it's not clear to
me that others aren't relying on it (e.g., extension modules).
2000-07-23 21:18:09 +00:00
Fredrik Lundh 56055a4749 -- added code to the new Windows popen functions to make close
return the exit code.  Only works on Windows NT/2000, due to
   limitations in the Win9X shell.
   (based on patch #100941 by David Bolen)
2000-07-23 19:47:12 +00:00
Tim Peters e21107145a Missed a return from a signal handler -- thanks to /F for pointing
it out!
2000-07-23 18:33:52 +00:00
Tim Peters 1be46844d9 Recent ANSIfication introduced a couple instances of
#if RETSIGTYPE != void
That isn't C, and MSVC properly refuses to compile it.
Introduced new Py_RETURN_FROM_SIGNAL_HANDLER macro in pyport.h
to expand to the correct thing based on RETSIGTYPE.  However,
only void is ANSI!  Do we still have platforms that return int?
The Unix config mess appears to #define RETSIGTYPE by magic
without being asked to, so I assume it's "a problem" across
Unices still.
2000-07-23 18:10:18 +00:00
Thomas Wouters 53e7fd77a7 Fix prototypes generated by makesetup, so they include '(void)' rather than
empty argumentlists.
2000-07-23 00:02:15 +00:00
Thomas Wouters bd4bc4e9e9 Even more ANSIfication: fix as many function pointers and declarations as
possible.
2000-07-22 23:57:55 +00:00
Thomas Wouters 3b6448fbae ANSIfication: add proper prototypes to function-pointers and declarations.
Also, fix a bug found by said declarations, where a string was defined as
unsigned char*, but used as signed.
2000-07-22 23:56:07 +00:00
Thomas Wouters 2c46eaf8e9 ANSIfication of function-pointers and declarations. Also, make sure to
return something if RETSIGTYPE is not void, in functions that are defined as
returning RETSIGTYPE.
2000-07-22 23:51:19 +00:00
Thomas Wouters 0796b00279 Further ANSIfication of functionpointers and declarations. Also, make sure
to return something if RETSIGTYPE isn't void, in functions that are defined
to return RETSIGTYPE. Work around an argumentlist mismatch ('void' vs.
'void *') by using a static wrapper function.
2000-07-22 23:49:30 +00:00
Thomas Wouters ba48a3f3ff Remove unused variable. 2000-07-22 16:41:08 +00:00
Thomas Wouters 1bc8c1eb83 Remove unused helper-function 'posix_strint'. 2000-07-22 16:39:39 +00:00
Thomas Wouters 3531730a68 Mark Favas's fix for typos in docstrings. 2000-07-22 16:34:15 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
and a couple of functions that were missed in the previous batches. Not
terribly tested, but very carefully scrutinized, three times.

All these were found by the little findkrc.py that I posted to python-dev,
which means there might be more lurking. Cases such as this:

long
func(a, b)
	long a;
	long b; /* flagword */
{

and other cases where the last ; in the argument list isn't followed by a
newline and an opening curly bracket. Regexps to catch all are welcome, of
course ;)
2000-07-21 06:00:07 +00:00
Skip Montanaro 49bd24d4e4 added history file truncation based upon code from Johannes Zellner. 2000-07-19 16:54:53 +00:00
Thomas Wouters 616607a987 ANSIfy the just-checked-in isatty() wrapper. 2000-07-19 14:45:40 +00:00
Skip Montanaro 1517d842b6 new method isatty from Thomas Wouters 2000-07-19 14:34:14 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Jack Jansen 307d7a426f Implemented getdefaultlocale() for macintosh, after an idea by Fredrik. 2000-07-15 22:31:45 +00:00
Thomas Wouters 70c21a1603 Move (actually copy) support for the sgi._getpty() function into
posix.openpty(). And conveniently also check if CVS write access really
works.

Closes SF patch #100722
2000-07-14 14:28:33 +00:00
Andrew M. Kuchling 9f28a039f6 Use PyObject_AsFileDescriptor 2000-07-13 23:59:35 +00:00
Peter Schneider-Kamp 9656abd913 ANSI-fication (got lost in the deep seas of source forge <wink>) 2000-07-13 21:10:57 +00:00
Andrew M. Kuchling 8d2f2b2db2 From Sam Rushing's Medusa, via SF patch #100858: add & document
os.seteuid(), os.setegid(), os.setreuid(), os.setregid().
2000-07-13 01:26:58 +00:00
Jeremy Hylton 03657cfdb0 replace PyXXX_Length calls with PyXXX_Size calls 2000-07-12 13:05:33 +00:00
Guido van Rossum 3f2fa0a53d Add "exceptions" to list of built-in modules for the sake of
sys.builtin_module_names.  (Noticed by Toby Dickenson.)
2000-07-12 12:09:05 +00:00
Sjoerd Mullender 0ae528447f Fixed up some ANSIfications. 2000-07-12 10:43:11 +00:00
Barry Warsaw 35e459c3eb debug_instance(): Use the same %p format directive as with
debug_cycle(), and don't cast the pointer to a long.  Neither needs
the literal `0x' prefix as %p automatically inserts this (on Linux at
least).
2000-07-12 05:18:36 +00:00
Fred Drake 0582df98d3 Convert coding style to be internally consistent and similar to the
rest of the Python C code: space between "if", "for" and "(", no space
between "(", ")" and function call parameters, etc.
2000-07-12 04:49:00 +00:00
Fred Drake cc1be2401e Always use the :funcname part of the format specifier for PyArg_ParseTuple()
so we get better error messages.
2000-07-12 04:42:23 +00:00
Andrew M. Kuchling c72c3bed77 Fix bugs in readinst():
* There was no error reported if the .read() method returns a non-string
* If read() returned too much data, the buffer would be overflowed causing a
  core dump
* Used strncpy, not memcpy, which seems incorrect if there are embedded \0s.
* The args and bytes objects were leaked
2000-07-12 01:27:18 +00:00
Andrew M. Kuchling a4e75d74f8 Patch #100854 from jhylton: eliminate compiler warnings in pyexpat:
The first two warnings seem harmless enough,
	but the last one looks like a potential bug: an
	uninitialized int is returned on error. (I also
	ended up reformatting some of the code,
	because it was hard to read.)
2000-07-12 00:53:41 +00:00
Vladimir Marangozov 9e3d73af93 Fix mixed mallocs: re->re_patbuf.buffer is allocated with std malloc(). 2000-07-12 00:49:17 +00:00
Peter Schneider-Kamp 618e25dfdf Errare humanum est.
Changed parameter in getsockaddrlen from unsigned to socklen_t.
2000-07-11 23:00:12 +00:00
Jack Jansen e4b4863296 One more include of limits.h (possibly to be moved elsewhere when there is
consensus where it should go).
2000-07-11 21:35:02 +00:00
Jeremy Hylton 672fac0d65 satisfy the -Wall: remove two unused local variables and unused ins function 2000-07-11 20:30:05 +00:00
Peter Schneider-Kamp 88e1932930 fixed a warning in getsockaddrlen 2000-07-11 17:40:30 +00:00
Fred Drake b35de5b78a Neil Schemenauer <nascheme@enme.ucalgary.ca>:
Change a cast, intialize a local, and make some sprintf() format strings
type-appropriate (add the "l" to "%d").

Closes SourceForge patch #100737.
2000-07-11 14:37:41 +00:00
Tim Peters dc0c031ad8 Now that prototypes are in scope, the compiler gives legit wngs
about int size mismatches at two calls to s_rand.  Stuffed in
casts to make the code do what it did before but w/o warnings --
although unclear that's correct!
2000-07-10 22:41:30 +00:00
Peter Schneider-Kamp 3e3175b5e7 ANSI-fication (fixed on parameter list I messed up in the patch) 2000-07-10 17:25:37 +00:00
Peter Schneider-Kamp 8bc8f0d036 ANSI-fication 2000-07-10 17:15:07 +00:00
Peter Schneider-Kamp 3646366f4c ANSI-fication, added #ifdef construction in mpz_coerce 2000-07-10 17:14:00 +00:00
Peter Schneider-Kamp cb27c35aa6 ANSI-fication, not really tested, but should (hopefully) compile 2000-07-10 17:06:38 +00:00
Peter Schneider-Kamp 6a85027a97 ANSI-fication of the SGI modules (note that svmodule.c and sgimodule.c
have already been checked in)

UNTESTED!
2000-07-10 17:04:33 +00:00
Fredrik Lundh 10723347c6 - stupid typo. 2000-07-10 16:38:09 +00:00
Fredrik Lundh 44328e60df -- get rid of a compiler warning on unix. (as reported
for #100836, but implemented in a different way)
2000-07-10 15:59:30 +00:00
Peter Schneider-Kamp 39e0e5a180 ANSI-fication 2000-07-10 13:12:27 +00:00
Peter Schneider-Kamp 7d0c71ac8c ANSI-fication 2000-07-10 13:05:29 +00:00
Peter Schneider-Kamp 286da3b46a ANSI-fying
added excplicit node * parameter to termvalid argument in
validate_two_chain_ops of parsermodule.c (as proposed by fred)
2000-07-10 12:43:58 +00:00
Peter Schneider-Kamp 41c36ffe83 ANSI-fication 2000-07-10 12:29:26 +00:00
Peter Schneider-Kamp 416d413527 ANSI-fication 2000-07-10 12:15:54 +00:00
Peter Schneider-Kamp e89b15691e ANSI-fication 2000-07-10 12:04:18 +00:00
Peter Schneider-Kamp c4bc0e0895 ANSI-fication 2000-07-10 11:56:03 +00:00
Peter Schneider-Kamp 0659b4af46 ANSI-fication 2000-07-10 10:49:30 +00:00
Peter Schneider-Kamp 3707efef9b ANSI-fication 2000-07-10 10:03:58 +00:00
Peter Schneider-Kamp a788a7f0fb ANSI-fication 2000-07-10 09:57:19 +00:00
Peter Schneider-Kamp fe74263cec ANSI-fication 2000-07-10 09:55:32 +00:00
Peter Schneider-Kamp 8235f1c834 ANSI-fication 2000-07-10 09:43:24 +00:00
Peter Schneider-Kamp f1ca898d85 ANSI-fication 2000-07-10 09:31:34 +00:00
Peter Schneider-Kamp faaad372ec ANSI-fication (and test if committing files works now) 2000-07-10 09:26:41 +00:00
Vladimir Marangozov b16714b4d0 Initialize the return value in collect_generations() since it is updated
conditionally in the code.
2000-07-10 05:37:39 +00:00
Fred Drake 859bad00cb Guido said include these in the Great ANSI-fication, so here they are! 2000-07-10 04:20:57 +00:00
Fredrik Lundh 9ac81f69b2 - changed the nt.popen2 return values back to
(write, read, ...), based on feedback from GvR.

- added tuple-swapping code to popen2.py

- fixed some runaway indentation in posixmodule.c
2000-07-09 23:35:24 +00:00
Fredrik Lundh 620f37723f - changed 1.5 to 2.0 in the help text
(the PYTHONHOMEHELP define)

- ANSI-fication
  (patch #100794 by Peter Schneider-Kamp)
2000-07-09 20:42:34 +00:00
Fredrik Lundh faa209d6bd - ANSI-fication
(patch #100805 by Peter Schneider-Kamp)
2000-07-09 20:35:15 +00:00
Fredrik Lundh bb7eeff44a - added popen.popen2/popen3/popen4 support for
windows.

- added optional mode argument to popen2/popen3
  for unix; if the second argument is an integer,
  it's assumed to be the buffer size.

- changed nt.popen2/popen3/popen4 return values
  to match the popen2 module (stdout first, not
  stdin).
2000-07-09 17:59:32 +00:00
Fredrik Lundh 766ccdcf18 - added optional bufsize argument to new popen methods.
for the moment, this argument must be left out or set
  to -1 (only the default bufsize is supported, that is)
2000-07-09 17:41:01 +00:00
Fredrik Lundh f5accf38ea - ANSI-fication
(patch #100784 by Peter Schneider-Kamp)
2000-07-09 15:14:52 +00:00
Fredrik Lundh 3c5d43d342 - ANSI-ification
(patch #100770 by Peter Schneider-Kamp)
2000-07-09 15:09:56 +00:00
Fredrik Lundh ffb9c770f8 - improved os.popen support for windows, based on win32pipe
by Bill Tutt.

  note: to run this on Windows 95/98, you need to have the
  w9xpopen.exe helper in the same directory as the python DLL.
2000-07-09 14:49:51 +00:00
Fred Drake 3cd2ee4037 Remove use of HAVE_OLD_CPP to support non-ANSI preprocessors. 2000-07-09 14:36:13 +00:00
Andrew M. Kuchling ad9b1f8533 Patch from Peter Schneider-Kamp: convert curses module to ANSI prototypes,
and substitute the conventional "args" instead of "arg".
2000-07-09 14:35:00 +00:00
Fredrik Lundh 5cccf50931 - added (long) casts to a couple of Py_BuildValue calls,
just for the sake of it.

  note that this only covers the unlikely case that size_t
  is smaller than a long; it's probably more likely that
  there are platforms out there where size_t is *larger*
  than a long, and mmapmodule cannot really deal with that
  today.
2000-07-09 13:16:13 +00:00
Fredrik Lundh e25cfd8662 - fixed pointer size test in spawn functions. also added
cast to make sure Py_BuildValue gets the right thing.

  this change eliminates bogus return codes from successful
  spawn calls (e.g. 2167387144924954624 instead of 0).
2000-07-09 13:10:40 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Fredrik Lundh ff7df9d7b8 this one's a bit risky, but I've spent some considerable time
staring at the diffs before checking this one in.  let me know
asap if it breaks things on your platform.

-- ANSI-fying
   (patch #100763 by Peter Schneider-Kamp, minus the
    indentation changes and minus the changes the broke
    the windows build)
2000-07-08 22:48:53 +00:00
Fredrik Lundh 54cf3dc88c -- ANSI-fying, names
(patch #100762 by Peter Schneider-Kamp, minus the
    indentation changes)

-- added INT_PTR workaround to make it build under VC 5.0
2000-07-08 22:05:01 +00:00
Fredrik Lundh 89610a4d50 - _getdefaultlocale shouldn't accept arguments
- some more spacification...
2000-07-08 20:07:24 +00:00
Fredrik Lundh 8f017a01f8 - added _getdefaultlocale implementation for WIN32
- ansified, reindentified, spacified, nullified
2000-07-08 19:57:37 +00:00
Fred Drake 51b6bc55e3 ANSI-fication of the sources, convert to 4-space indents.
Use PyArg_ParseTuple() to get better error messages.
Add docstrings all around.
2000-07-08 16:56:26 +00:00
Fred Drake 2c4a3dceaf ANSI-fied sources, converted to four-space indentation.
Converted to PyArg_ParseTuple() with method names to get better error
messages.
2000-07-08 06:41:03 +00:00
Fred Drake edabdc1e9e ANSI-fied sources, converted to four-space indentation. 2000-07-08 06:16:37 +00:00
Fred Drake da940d8f8d Add method names to PyArg_ParseTuple() calls for better error messages.
Convert to four-space indents.
2000-07-08 06:05:58 +00:00
Fred Drake e3a41c653a ANSI-fy the sources.
Convert to using PyArg_ParseTuple() as appropriate to allow method names
in error messages.
Re-indent to four-space indentation.
2000-07-08 05:00:07 +00:00
Fred Drake 0c89d4ec9a Pretensions of the 20th century... remove old-style preprocessor
hackery (/**/), leaving only new-style preprocessor hackery (##).
2000-07-08 04:53:48 +00:00
Fred Drake 5639ba4896 ANSI-fy the sources. 2000-07-08 04:12:08 +00:00
Fred Drake 509d79adaf Removed Py_PROTO, ANSI-fied sources. 2000-07-08 04:04:38 +00:00
Fred Drake e55d5446ea Thomas Wouters <thomas@xs4all.net>:
Allow -f* parameters to be passed to the compiler from Setup files.
2000-07-07 16:21:31 +00:00
Marc-André Lemburg 71f36983b9 Removed a prototype which is not used in socketmodule.c
Patch by T. Wouters.
2000-07-07 14:13:29 +00:00
Fred Drake 49b0c3bafe Fix bug #392, reported by Jonathan Giddy <jon@dstc.edu.au>:
In posixmodule.c:posix_fork, the function PyOS_AfterFork is called for
both the parent and the child, despite the docs stating that it should
be called in the new (child) process.

This causes problems in the parent since the forking thread becomes the
main thread according to the signal module.

Calling PyOS_AfterFork() only in the child fixes this.  Changed for both
fork() and forkpty().
2000-07-06 19:42:19 +00:00
Fred Drake 589c35bcc7 Python 2.0 is not supposed to use string exceptions in the standard library
& extensions, so create exceptions in extension modules using the
PyErr_NewException() API.
2000-07-06 19:38:49 +00:00
Skip Montanaro 28067821e2 added read_history_file and write_history_file
XXX should perhaps support history truncation as well
2000-07-06 18:55:12 +00:00
Andrew M. Kuchling 1a10400692 Removed unused variables.
Added two functions that were left out of the method definition table.
2000-07-06 18:14:03 +00:00
Skip Montanaro fd022672a0 don't prepend "$(srcdir)/" to paths beginning with "$" since they are likely
to be absolute.
2000-07-06 17:58:06 +00:00
Tim Peters 54925f98d3 Add more "volatile" decls to stop gcc -Wall warnings.
Somebody w/ gcc please check that the wngs are gone!
There are cheaper (at runtime) ways to prevent the wngs, but
they're obscure and delicate.  I'm going for the easy Big
Hammer here under the theory that PCRE will be replaced by
SRE anyway.
2000-07-05 22:56:52 +00:00
Fredrik Lundh 2855290b84 maintenance release:
- reorganized some code to get rid of -Wall and -W4
  warnings

- fixed default argument handling for sub/subn/split
  methods (reported by Peter Schneider-Kamp).
2000-07-05 21:14:16 +00:00
Andrew M. Kuchling da13f89fee Remove definition of _GNU_SOURCE, since Python.h now does it for us 2000-07-05 12:22:14 +00:00
Marc-André Lemburg 5f0e29eb45 Modified the encode interfaces of all builtin codecs to accept
any object which can be converted to Unicode by means of
PyUnicode_FromObject().
2000-07-05 11:24:13 +00:00
Fred Drake 7bd9f41c65 pyexpat.errors is a *strange* module!
It gets initialized when pyexpat is imported, and is only accessible as an
attribute of pyexpat; it cannot be imported itself.  This allows it to at
least be importable after pyexpat itself has been imported by adding it
to sys.modules, so it is not quite as strange.

This arrangement needs to be better thought out.
2000-07-04 23:51:31 +00:00
Fred Drake 7797d3692b Remove warning about local variable possibly being using uninitialized;
noted by Marc-Andre Lemburg <mal@lemburg.com>.
2000-07-04 18:48:46 +00:00
Andrew M. Kuchling 637f6642f2 Fixes for compilation problems on Tru64 reported by Mark Favas 2000-07-04 14:53:43 +00:00
Marc-André Lemburg 8bcfb8a5e0 Fixed symbol search for defining NSIG. It now also checks _NSIG
which some C libs define (e.g. glibc).

Added a fallback default value for NSIG which hopefully provides
enough room for signal slots.
2000-07-04 14:17:33 +00:00
Tim Peters 489d54ef66 Typo repair in docstring -- my fault. 2000-07-03 22:41:34 +00:00
Jack Jansen ee398fa058 Mac only: two epoch problem workarounds are no longer needed for GUSI
>= 2.0.5. One still is:-(
2000-07-03 21:37:27 +00:00
Fredrik Lundh 72b82ba16d - fixed grouping error bug
- changed "group" operator to "groupref"
2000-07-03 21:31:48 +00:00
Fredrik Lundh 6f01398236 - added lookbehind support (?<=pattern), (?<!pattern).
the pattern must have a fixed width.

- got rid of array-module dependencies; the match pro-
  gram is now stored inside the pattern object, rather
  than in an extra string buffer.

- cleaned up a various of potential leaks, api abuses,
  and other minors in the engine module.

- use mal's new isalnum macro, rather than my own work-
  around.

- untabified test_sre.py.  seems like I removed a couple
  of trailing spaces in the process...
2000-07-03 18:44:21 +00:00
Fred Drake 40c48685a2 ANSI-fication, remove Py_PROTO, etc.
Revise math_1(), math_2(), stub-generating macros, and function tables to
use PyArg_ParseTuple() and properly provide the function name for error
message generation.
Fix pow() docstring for MPW 3.1; had said "power" instead of "pow".
2000-07-03 18:11:56 +00:00
Fred Drake 22269b5976 Andrew Kuchling <akuchlin@mems-exchange.org>:
Typo in string literal: execpt --> except
2000-07-03 18:07:43 +00:00
Fredrik Lundh c2301730b8 - experimental: added two new attributes to the match object:
"lastgroup" is the name of the last matched capturing group,
  "lastindex" is the index of the same group.  if no group was
  matched, both attributes are set to None.

  the (?P#) feature will be removed in the next relase.
2000-07-02 22:25:39 +00:00
Tim Peters c9c02c4cf3 Repair docs for math.frexp (they were wrong).
Reported on c.l.py by Kirill Simonov.
2000-07-02 20:17:08 +00:00
Fredrik Lundh 7cafe4d7e4 - actually enabled charset anchors in the engine (still not
used by the code generator)

- changed max repeat value in engine (to match earlier array fix)

- added experimental "which part matched?" mechanism to sre; see
  http://hem.passagen.se/eff/2000_07_01_bot-archive.htm#416954
  or python-dev for details.
2000-07-02 17:33:27 +00:00
Fredrik Lundh 3562f11764 -- use charset bitmaps where appropriate. this gives a 5-10%
speedup for some tests, including the python tokenizer.

-- added support for an optional charset anchor to the engine
   (currently unused by the code generator).

-- removed workaround for array module bug.
2000-07-02 12:00:07 +00:00
Fredrik Lundh c13222cdff - fixed "{ in any other context" bug
- minor comment touchups in the C module
2000-07-01 23:49:14 +00:00
Fredrik Lundh 22d2546520 today's SRE update:
-- changed 1.6 to 2.0 in the file headers

-- fixed ISALNUM macro for the unicode locale.  this
   solution isn't perfect, but the best I can do with
   Python's current unicode database.
2000-07-01 17:50:59 +00:00
Fred Drake 728819af5d Restore strict checking of socket address values; addresses passed to
the bind(), connect(), and connect_ex() methods must be a single
parameter.

Originally part of 1.98, reverted in 1.100.
2000-07-01 03:40:12 +00:00
Guido van Rossum db67739d4f Jack Jansen, Mac patch:
Include limits.h if we have it.
2000-07-01 01:09:43 +00:00
Guido van Rossum ce8e1dc395 clean up warnings in Win32 build of mmapmodule.c 2000-07-01 00:51:51 +00:00
Guido van Rossum 9f754e0e2d In b_setitem(), instead of the platform dependent CHAR_MIN and
CHAR_MAX, use hardcoded -128 and 127.  This may seem strange, unless
you realize that we're talking about signed bytes here!  Bytes are
always 8 bits and 2's complement.  CHAR_MIN and CHAR_MAX are
properties of the char data type, which is guaranteed to hold at least
8 bits anyway.

Otherwise you'd get failing tests on platforms where unsigned char is
the default (e.g. AIX).

Thanks, Vladimir Marangozov, for finding this nit!
2000-07-01 00:38:19 +00:00
Guido van Rossum ef4bb5ffe1 Change copyright notice. 2000-07-01 00:16:13 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum 276fa43faf Fix another error on AIX by using a proper cast. 2000-06-30 23:04:18 +00:00
Guido van Rossum 64529cd7ce Crude way to fix a problem on AIX: #undef STAT before defining it. 2000-06-30 22:45:12 +00:00
Fredrik Lundh ef34bd2c0d -- changed $ to match before a trailing newline, even
if the multiline flag isn't given.
2000-06-30 21:40:20 +00:00
Barry Warsaw 257543c78d Setup.thread.in was misnamed so it has been replaced by
Setup.config.in.  The latter contains all configure-time selectable
modules; currently thread and gc.
2000-06-30 16:12:15 +00:00
Barry Warsaw 5a06fae399 Add Setup.config 2000-06-30 16:09:01 +00:00
Barry Warsaw 61b49b3d6b Removed the comment about the thread module. 2000-06-30 16:05:22 +00:00
Barry Warsaw 6de7213e7a Setup.thread => Setup.config 2000-06-30 16:04:18 +00:00
Fred Drake a44d353e2b Trent Mick <trentm@activestate.com>:
The common technique for printing out a pointer has been to cast to a long
and use the "%lx" printf modifier. This is incorrect on Win64 where casting
to a long truncates the pointer. The "%p" formatter should be used instead.

The problem as stated by Tim:
> Unfortunately, the C committee refused to define what %p conversion "looks
> like" -- they explicitly allowed it to be implementation-defined. Older
> versions of Microsoft C even stuck a colon in the middle of the address (in
> the days of segment+offset addressing)!

The result is that the hex value of a pointer will maybe/maybe not have a 0x
prepended to it.


Notes on the patch:

There are two main classes of changes:
- in the various repr() functions that print out pointers
- debugging printf's in the various thread_*.h files (these are why the
patch is large)


Closes SourceForge patch #100505.
2000-06-30 15:01:00 +00:00
Fredrik Lundh 0640e1161f the mad patcher strikes again:
-- added pickling support (only works if sre is imported)

-- fixed wordsize problems in engine
   (instead of casting literals down to the character size,
   cast characters up to the literal size (same as the code
   word size).  this prevents false hits when you're matching
   a unicode pattern against an 8-bit string. (unfortunately,
   this broke another test, but I think the test should be
   changed in this case; more on that on python-dev)

-- added sre.purge function
   (unofficial, clears the cache)
2000-06-30 13:55:15 +00:00
Fredrik Lundh 43b3b49b5a - fixed lookahead assertions (#10, #11, #12)
- untabified sre_constants.py
2000-06-30 10:41:31 +00:00
Fredrik Lundh df02d0b3f0 - fixed default value handling in group/groupdict
- added test suite
2000-06-30 07:08:20 +00:00
Jeremy Hylton c5007aa5c3 final patches from Neil Schemenauer for garbage collection 2000-06-30 05:02:53 +00:00
Fred Drake 947121fd9c Add a comment about needing to change a #include if using a version of
Berkeley DB 2.0 or newer; most Linux distros will include a more recent
version than 1.85.
2000-06-30 04:17:11 +00:00
Fred Drake a04eaad5c7 Trent Mick <trentm@activestate.com>:
This patch fixes possible overflows in the socket module for 64-bit
platforms (mainly Win64). The changes are:

- abstract the socket type to SOCKET_T (this is SOCKET on Windows, int
on Un*x), this is necessary because sizeof(SOCKET) > sizeof(int) on
Win64

- use INVALID_SOCKET on Win32/64 for an error return value for
accept()

- ensure no overflow of the socket variable for: (1) a PyObject return
value (use PyLong_FromLongLong if necessary); and (2) printf
formatting in repr().

Closes SourceForge patch #100516.
2000-06-30 02:46:07 +00:00
Guido van Rossum f385c5e544 Patch by Nadav Horesh to make acosh and asinh better.
Tim posted a long comment to python-dev (subject: "Controversial patch
(cmath)"; date: 6/29/00).  The conclusion is that this whole module
stinks and this patch isn't perfect, but it's better than the acosh
and asinh we had, so let's check it in.
2000-06-30 02:29:22 +00:00
Fredrik Lundh 01016fe972 - fixed split behaviour on empty matches
- fixed compiler problems when using locale/unicode flags

- fixed group/octal code parsing in sub/subn templates
2000-06-30 00:27:46 +00:00
Fredrik Lundh 29c08beab0 still trying to figure out how to fix the remaining
group reset problem.  in the meantime, I added some
optimizations:

- added "inline" directive to LOCAL

  (this assumes that AC_C_INLINE does what it's
  supposed to do).  to compile SRE on a non-unix
  platform that doesn't support inline, you have
  to add a "#define inline" somewhere...

- added code to generate a SRE_OP_INFO primitive

- added code to do fast prefix search

  (enabled by the USE_FAST_SEARCH define; default
  is on, in this release)
2000-06-29 23:33:12 +00:00
Fred Drake 0e12395190 Trent Mick <trentm@activestate.com>:
This patch fixes a possible overflow in the Sleep system call on
Win32/64 in the time_sleep() function in the time module. For very
large values of the give time to sleep the number of milliseconds can
overflow and give unexpected sleep intervals. THis patch raises an
OverflowError if the value overflows.

Closes SourceForge patch #100514.
2000-06-29 21:31:02 +00:00
Fred Drake 699f352fb2 Trent Mick <trentm@activestate.com>:
This patch fixes the posix module for large file support mainly on
Win64, although some general cleanup is done as well.

The changes are:

- abstract stat->STAT, fstat->FSTAT, and struct stat->STRUCT_STAT
This is because stat() etc. are not the correct functions to use on
Win64 (nor maybe on other platforms?, if not then it is now trivial to
select the appropriate one). On Win64 the appropriate system functions
are _stati64(), etc.

- add _pystat_fromstructstat(), it builds the return tuple for the
fstat system call. This functionality was being duplicated. As well
the construction of the tuple was modified to ensure no overflow of
the time_t elements (sizeof(time_t) > sizeof(long) on Win64).

- add overflow protection for the return values of posix_spawnv and
posix_spawnve

- use the proper 64-bit capable lseek() on Win64

- use intptr_t instead of long where appropriate from Win32/64 blocks
(sizeof(void*) > sizeof(long) on Win64)

This closes SourceForge patch #100513.
2000-06-29 21:12:41 +00:00
Fred Drake dfb4ebda24 Trent Mick <trentm@activestate.com>:
Mark Hammond provided (a long time ago) a better Win32 specific
time_clock implementation in timemodule.c. The library for this
implementation does not exist on Win64 (yet, at least). This patch
makes Win64 fall back on the system's clock() function for
time_clock().

This closes SourceForge patch #100512.
2000-06-29 20:56:28 +00:00
Fredrik Lundh 8094611eb8 - fixed another split problem
(those semantics are weird...)

- got rid of $Id$'s (for the moment, at least).  in other
  words, there should be no more "empty" checkins.

- internal: some minor cleanups.
2000-06-29 18:03:25 +00:00
Fredrik Lundh be2211e940 - fixed split
(test_sre still complains about split, but that's caused by
  the group reset bug, not split itself)

- added more mark slots
  (should be dynamically allocated, but 100 is better than 32.
  and checking for the upper limit is better than overwriting
  the memory ;-)

- internal: renamed the cursor helper class

- internal: removed some bloat from sre_compile
2000-06-29 16:57:40 +00:00
Barry Warsaw 3937c8a738 Updated the comment in this file to reflect the new defaults. Threads
are enabled by default now unless --without-threads is given to
configure.
2000-06-29 16:08:28 +00:00
Jeremy Hylton a22a0b3e86 pyexpat notes: add the name of the archive to the ar command 2000-06-29 14:40:45 +00:00
Fredrik Lundh b389df3402 - renamed "tolower" hook (it happened to work with
my compiler, but not on guido's box...)
2000-06-29 12:48:37 +00:00
Fredrik Lundh 75f2d675ed - last patch broke parse_template; fixed by changing some
tests in sre_patch back to previous version

- fixed return value from findall

- renamed a bunch of functions inside _sre (way too
  many leading underscores...)

</F>
2000-06-29 11:34:28 +00:00
Fredrik Lundh 6c68dc7b1a - removed "alpha only" licensing restriction
- removed some hacks that worked around 1.6 alpha bugs
- removed bogus test code from sre_parse
2000-06-29 10:34:56 +00:00
Fredrik Lundh 436c3d58a2 towards 1.6b1 2000-06-29 08:58:44 +00:00
Fredrik Lundh 102f3ad676 towards 1.6b1 2000-06-29 08:55:54 +00:00
Fred Drake 3de16f3db4 Improve explanation of how to build the pyexpat module. 2000-06-29 05:29:08 +00:00
Guido van Rossum 4f4b799b33 Jack Jansen: Use include "" instead of <>; and staticforward declarations 2000-06-29 00:06:39 +00:00
Guido van Rossum cc6a438d7f Trent Mick:
Fix warnings on 64-bit build build of signalmodule.c

- Though I know that SIG_DFL and SIG_IGN are just small constants,
there are cast to function pointers so the appropriate Python call is
PyLong_FromVoidPtr so that the pointer value cannot overflow on Win64
where sizeof(long) < sizeof(void*).
2000-06-28 22:26:21 +00:00
Guido van Rossum 534b7c5c96 Trent Mick:
This patch fixes cPickle.c for 64-bit platforms.

- The false assumption sizeof(long) == size(void*) exists where
PyInt_FromLong is used to represent a pointer. The safe Python call
for this is PyLong_FromVoidPtr. (On platforms where the above
assumption *is* true a PyInt is returned as before so there is no
effective change.)

- use size_t instead of int for some variables
2000-06-28 22:23:56 +00:00
Guido van Rossum fa48116993 Trent Mick: use size_t instead of int where appropriate (time_strftime()). 2000-06-28 21:33:59 +00:00
Guido van Rossum e826895d48 Trent Mick: use size_t instead of int where appropriate (set_key()). 2000-06-28 21:31:10 +00:00
Guido van Rossum 26418a90f0 Trent Mick: use size_t instead of int where appropriate (call_readline()). 2000-06-28 21:30:31 +00:00
Guido van Rossum 2650a42f0b Trent Mick: use size_t instead of int where appropriate (mpz_format()). 2000-06-28 21:29:47 +00:00
Guido van Rossum b6f657c0cc Trent Mick: use size_t instead of int where appropriate (various spots). 2000-06-28 21:29:03 +00:00
Guido van Rossum 7d0ae5e14e Trent Mick: use size_t instead of int where appropriate (in
fromfile(), to hold fread() result.)
2000-06-28 21:27:21 +00:00
Guido van Rossum 2f8a054418 Trent Mick: use size_t instead of int where appropriate (in strxfrm(),
to hold strlen() outcome).
2000-06-28 21:23:33 +00:00
Guido van Rossum 3262e16753 Trent Mick:
This patches fixes a possible overflow of the optional timeout
parameter for the select() function (selectmodule.c). This timeout is
passed in as a double and then truncated to an int. If the double is
sufficiently large you can get unexpected results as it
overflows. This patch raises an overflow if the given select timeout
overflows.

[GvR: To my embarrassment, the original code was assuming an int could
always hold a million.  Note that the overflow check doesn't test for
a very large *negative* timeout passed in -- but who in the world
would do such a thing?]
2000-06-28 21:18:13 +00:00
Guido van Rossum 40ced50cb0 Jack Jansen: Mac Carbon: don't include sys/types if we don't have it 2000-06-28 20:56:30 +00:00
Fred Drake 541dc3b7b2 Trent Mick <trentm@activestate.com>:
The cause: Relatively recent (last month) patches to getargs.c added
overflow checking to the PyArg_Parse*() integral formatters thereby
restricting 'b' to unsigned char value and 'h','i', and 'l' to signed
integral values (i.e. if the incoming value is outside of the
specified bounds you get an OverflowError, previous it silently
overflowed).

The problem: This broke the array module (as Fredrik pointed out)
because *its* formatters relied on the loose allowance of signed and
unsigned ranges being able to pass through PyArg_Parse*()'s
formatters.

The fix: This patch fixes the array module to work with the more
strict bounds checking now in PyArg_Parse*().

How: If the type signature of a formatter in the arraymodule exactly
matches one in PyArg_Parse*(), then use that directly. If there is no
equivalent type signature in PyArg_Parse*() (e.g. there is no unsigned
int formatter in PyArg_Parse*()), then use the next one up and do some
extra bounds checking in the array module.

This partially closes SourceForge patch #100506.
2000-06-28 17:49:30 +00:00
Marc-André Lemburg 2dabf69f5c Marc-Andre Lemburg <mal@lemburg.com>:
Added new ucnhash module by Bill Tutt.
2000-06-28 16:42:39 +00:00
Marc-André Lemburg b0c0ecfa26 Marc-Andre Lemburg <mal@lemburg.com>:
Added new ucnhash module.
2000-06-28 16:42:14 +00:00
Fred Drake 8cef4cf737 Thomas Wouters <thomas@xs4all.net>:
This patch adds the openpty() and forkpty() library calls to posixmodule.c,
when they are available on the target
system. (glibc-2.1-based Linux systems, FreeBSD and BSDI at least, probably
the other BSD-based systems as well.)

Lib/pty.py is also rewritten to use openpty when available, but falls
back to the old SGI method or the "manual" BSD open-a-pty
code. Openpty() is necessary to use the Unix98 ptys under Linux 2.2,
or when using non-standard tty names under (at least) BSDI, which is
why I needed it, myself ;-) forkpty() is included for symmetry.
2000-06-28 16:40:38 +00:00
Marc-André Lemburg 8fb8748a5f Marc-Andre Lemburg <mal@lemburg.com>:
New ucnhash module by Bill Tutt. This module contains the hash
table needed to map Unicode character names to Unicode ordinals
and is loaded on-the-fly by the standard unicode-escape codec.
2000-06-28 16:38:56 +00:00
Andrew M. Kuchling a1e4b05ac4 Fixes for compiling on Tru64.
Define a STRICT_SYSV_CURSES macro on SGI, Sun, and Tru64, to mark systems
that don't support some features.
2000-06-27 21:49:47 +00:00
Andrew M. Kuchling b6e468796a Fix two typos (, instead of ;) 2000-06-27 15:01:10 +00:00
Andrew M. Kuchling 8e9d23b250 Added support for mouse functions: mousemask(), mouseinterval(),
getmouse(), ungetmouse(), and window.enclose().  wmouse_trafo() seems
of marginal importance at the moment.
2000-06-27 03:10:38 +00:00
Andrew M. Kuchling beba056cd7 Added support for passing Unicode strings to Expat handlers by default.
This version still includes #ifdef hackery to compile with 1.5.2.
2000-06-27 00:33:30 +00:00
Andrew M. Kuchling f419572708 Release the global interpreter lock around the most important
functions that might block or pause
2000-06-23 01:36:21 +00:00
Andrew M. Kuchling 97311bbb0e Added .timeout() method and .typeahead() function 2000-06-21 01:41:48 +00:00
Fred Drake aef1000bff Fixed docstring typo, reported by Skip Montanaro <skip@mojam.com>. 2000-06-19 13:17:41 +00:00
Andrew M. Kuchling 288e97b7fe Patch from Michael Hudson to fix flatten recursive data structures:
[mwh21@atrus build]$ ./python
>>> import Tkinter
>>> l = []
>>> l.append(l)
>>> Tkinter._flatten(l)
Segmentation fault (core dumped)
2000-06-19 00:55:09 +00:00
Andrew M. Kuchling ea34a84e54 Patch from Lorenzo M. Catucci:
I discovered the [MREMAP_MAYMOVE] symbol is only defined when _GNU_SOURCE is
defined; therefore, here is the change: if we are compiling for linux,
define _GNU_SOURCE before including mman.h, and all is done.
2000-06-18 19:06:49 +00:00
Andrew M. Kuchling e475e70128 Patch from /F:
this patch adds a fast _flatten function to the _tkinter
module, and imports it from Tkinter.py (if available).

this speeds up canvas operations like create_line and
create_polygon.  for example, a create_line with 5000
vertices runs about 50 times faster with this patch in
place.
2000-06-18 18:45:50 +00:00
Andrew M. Kuchling 6fef30e1fa Support resizing the mapping depending on whether HAVE_MREMAP is defined
Remove two unused variables
2000-06-18 14:51:21 +00:00
Andrew M. Kuchling 70d2742fce Patch from Trent Mick:
The seek() method is broken for any 'whence' value (seek from
	start, current, orend) other than the default. I have a patch
	that fixes that as well as gets mmap'd files working on
	Linux64 and Win64.
2000-06-18 04:45:14 +00:00
Andrew M. Kuchling 9bc5f3339a Removed MS_INVALIDATE flags 2000-06-18 04:25:08 +00:00
Andrew M. Kuchling 7b9fb92932 Fix the size() method to return the size of the file on Unix, not the
size of the mapped area.  This seems to be what the Windows version does.
This change requires keeping around the fd of the mapped file.
2000-06-17 22:41:22 +00:00
Andrew M. Kuchling b7f198e01a Renamed the C extension for ncurses support from 'curses' to '_curses'.
(The SourceForge admins have been asked to rename the ,v file.)
2000-06-10 23:12:32 +00:00
Marc-André Lemburg 753131c90a Marc-Andre Lemburg <mal@lemburg.com>:
The locale module is turned on per default.
2000-06-07 09:12:54 +00:00
Andrew M. Kuchling 54c8dc2144 Patch from Trent Mick:
Fix a small bug in posixmodule.c where a char* is being
	dereferenced where it should not be.
2000-06-06 20:52:17 +00:00
Andrew M. Kuchling 841b9fbebb Use PyArg_ParseTuple and specify the method names, following a suggestion
from Greg Stein
2000-06-03 20:43:43 +00:00
Andrew M. Kuchling 961fe17b4c Add missing PyArg_NoArgs() calls to methods that didn't take arguments
(Pointed out by Moshe Zadka)
2000-06-03 19:41:42 +00:00
Jeremy Hylton b1aa19515f Fredrik Lundh: here's the 96.6% version of SRE 2000-06-01 17:39:12 +00:00
Andrew M. Kuchling 94c3452ade Fix bug reported by atkins@gweep.net; re.compile(r"[\100-\410]")
dumps core.  Solution: fix check_escape() to match its comment and
   use only the low 8 bits of the octal number.
2000-06-01 03:02:48 +00:00
Fred Drake 137507ea03 Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.
2000-06-01 02:02:46 +00:00
Jeremy Hylton 847a9968e9 Patch from M.-A. Lemburg:
Python on UNIX now trusts PYTHONHOME unconditionally

Modules/getpath.c:

Landmark changed to os.py.

Setting PYTHONHOME now unconditionally sets sys.prefix
(and sys.exec_prefix). No further checks are done whether the
standard lib can be found in that location or not. This is in
sync with the PC subdir getpath implementations.

PC/getpathp.c:

Landmark changed to os.py.

PC/os2vacpp/getpathp.c:

Landmark changed to os.py.

Note: BAW's checkin on exceptions.c eliminates earlier concerns about
a bogus PYTHONHOME value leading to a core dump.  Instead it causes a
useless sys.path and prevents imports.
2000-05-26 21:49:07 +00:00
Barry Warsaw c8019add6c _exceptions.c is moved to ../Python/exceptions.c 2000-05-26 19:03:19 +00:00
Barry Warsaw b1387aa7af The _exceptions module is moved to the Python subdirectory. 2000-05-26 19:02:42 +00:00
Barry Warsaw 8415edb433 Built-in class-based standard exceptions. Written by Fredrik Lundh.
Modified, proofread, and integrated for Python 1.6 by Barry Warsaw.
2000-05-25 23:18:47 +00:00
Barry Warsaw cfa2dba720 Added the _exceptions module, implementing the built-in class-based
standard exceptions.
2000-05-25 23:10:52 +00:00
Andrew M. Kuchling 03e644b851 Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Lots of typo fixes (a bit too much cut-and-paste in this module)
Aliases removed: attr_on, attr_off, attr_set
Lowercased the names COLOR_PAIR and PAIR_NUMBER
#ifdef's for compiling on Solaris added (need to understand SYSV curses
    versions better and generalize this)
Bumped version number bumped to 1.6
2000-05-23 16:24:54 +00:00
Andrew M. Kuchling 22b88ce6bf Oliver Andrich's ncurses-specific curses module, version 1.5b1 2000-05-23 16:18:03 +00:00
Fred Drake 11b093641a Donn Cave <donn@oz.net>:
BeOS (up to 5.0) lacks <netinet/tcp.h>.
2000-05-16 13:30:12 +00:00
Guido van Rossum c9a5f343bc The addition of rint() (by Peter Schneider-Kamp; I forgot to mention
that before) in the previous patch has one problem; rint() is not in
the C math library on all platforms (e.g. not for VC++).  Make it
conditional on HAVE_RINT.
2000-05-11 18:42:27 +00:00
Guido van Rossum 71260b846e Added math.rint() -- round according to current IEEE754 mode 2000-05-11 18:19:42 +00:00
Fred Drake aff601804d M.-A. Lemburg <mal@lemburg.com>:
Fixed a bug due to a /* inside /*...*/. GCC doesn't like
this and bombs.
2000-05-09 19:52:40 +00:00
Guido van Rossum ea2b7157ab New version from Jim Fulton to fix a problem that Eric Raymond ran
into.  Jim writes:

The core dump was due to a C decrement operation
in a macro invocation in load_pop.  (BAD)

I fixed this by moving the decrement outside
the macro call.

I added a comment to load_pop and load_mark
to document the fact that cPickle separates the
unpickling stack into two separate stacks, one for
objects and one for marks.

I also moved some increments out of some macro
calls (PyTuple_SET_ITEM and PyList_SET_ITEM).
This wasn't necessary, but made me feel better. :)

I tested these changes in *my* cPickle, which
doesn't have the new Unicode stuff.
2000-05-09 18:14:50 +00:00
Guido van Rossum c554505ca1 Trent Mick:
Fix overflow bug in ldexp(x, exp). The 'exp' argument maps to a C int for the
math library call [double ldexp(double, int)], however the 'd'
PyArg_ParseTuple formatter was used to yield a double, which was subsequently
cast to an int. This could overflow.

[GvR: mysteriously, on Solaris 2.7, ldexp(1, 2147483647) returns Inf
while ldexp(1, 2147483646) raises OverflowError; this seems a bug in
the math library (it also takes a real long time to compute the
Inf outcome).  Does this point to a bug in the CHECK() macro?  It
should have discovered that the result was outside the HUGE_VAL range.]
2000-05-08 14:29:38 +00:00
Guido van Rossum 69529ad0cc When the UTF-8 conversion to Unicode fails, return an 8-bit string
instead.  This seems more robust than returning an Unicode string with
some unconverted charcters in it.

This still doesn't support getting truly binary data out of Tcl, since
we look for the trailing null byte; but the old (pre-Unicode) code did
this too, so apparently there's no need.  (Plus, I really don't feel
like finding out how Tcl deals with this in each version.)
2000-05-04 15:55:17 +00:00
Guido van Rossum 990f5c6c98 Two changes to improve (I hope) Unicode support.
1. In Tcl 8.2 and later, use Tcl_NewUnicodeObj() when passing a Python
Unicode object rather than going through UTF-8.  (This function
doesn't exist in Tcl 8.1, so there the original UTF-8 code is still
used; in Tcl 8.0 there is no support for Unicode.)  This assumes that
Tcl_UniChar is the same thing as Py_UNICODE; a run-time error is
issued if this is not the case.

2. In Tcl 8.1 and later (i.e., whenever Tcl supports Unicode), when a
string returned from Tcl contains bytes with the top bit set, we
assume it is encoded in UTF-8, and decode it into a Unicode string
object.

Notes:

- Passing Unicode strings to Tcl 8.0 does not do the right thing; this
isn't worth fixing.

- When passing an 8-bit string to Tcl 8.1 or later that has bytes with
the top bit set, Tcl tries to interpret it as UTF-8; it seems to fall
back on Latin-1 for non-UTF-8 bytes.  I'm not sure what to do about
this besides telling the user to disambiguate such strings by
converting them to Unicode (forcing the user to be explicit about the
encoding).

- Obviously it won't be possible to get binary data out of Tk this
way.  Do we need that ability?  How to do it?
2000-05-04 15:07:16 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 2808b744e8 Remove all references to stdwin. 2000-05-03 22:34:12 +00:00
Guido van Rossum 31c9a27c12 >>Boing!<<
Finally, this long-obsolete module bites the dust.
2000-05-03 22:33:14 +00:00
Guido van Rossum 98e189dab4 Vladimir Marangozov:
Change Py_Malloc/Realloc/Free calls to PyMem_Malloc/Realloc/Free +
PyErr_Nomemory on error check.  Py_Malloc c.s. are obsolete.
2000-05-03 22:30:13 +00:00
Guido van Rossum 19dde103a8 Mark Hammond to the rescue:
Checkin 2.131 of posixmodule.c changed os.stat on Windows, so that
"/bin/" type notation (trailing backslash) would work on Windows to
be consistent with Unix.

However, the patch broke the simple case of: os.stat("\\")

This did work in 1.5.2, and obviously should!

This patch addresses this, and restores the correct behaviour.
2000-05-03 02:44:55 +00:00
Guido van Rossum 7d64b48eaf Disable the ZEROTRAP code -- this turns a 0 byte into a 2 byte and I
don't think that's what we want.  There was some brief discussion
of this somewhere but I don't recall where.
2000-05-02 21:18:13 +00:00
Barry Warsaw 57e11ae847 usage_mid: Remove the description of the -X flag; it's gone now.
Py_Main(): Remove the 'X' case.
2000-05-02 19:20:26 +00:00
Barry Warsaw ee98e4e75d Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
Guido van Rossum c15a9a1f98 Marc-Andre Lemburg:
Added -U command line option.

With the option enabled the Python compiler interprets all "..."
strings as u"..." (same with r"..." and ur"...").
2000-05-01 17:54:33 +00:00
Barry Warsaw 3cef856dd9 posix_utime(): Allow the second argument to be None, which invokes the
utime(path, NULL) call, setting the atime and mtime of the file to the
current time.  The previous signature utime(path, (atime, mtime)) is
of course still allowed.
2000-05-01 16:17:24 +00:00
Guido van Rossum 8823accd1f Marc-Andre Lemburg:
Fixes a memory leak found by Fredrik Lundh.
2000-04-27 20:14:31 +00:00
Guido van Rossum c410e92974 Jack Jansen:
This patch is a workaround for Macintosh, where the GUSI I/O library
(time, stat, etc) use the MacOS epoch of 1-Jan-1904 and the MSL C
library (ctime, localtime, etc) uses the (apparently ANSI standard)
epoch of 1-Jan-1900. Python programs see the MacOS epoch and we
convert values when needed.
2000-04-26 20:40:13 +00:00
Guido van Rossum 50422b403c Michael Hudson:
This patch changes posixmodule.c:execv to

a) check for zero length args (does this to execve, too), raising
   ValueError.

b) raises more rational exceptions for various flavours of duff arguments.
   I *hate*
      TypeError: "illegal argument type for built-in operation"
   It has to be one of the most frustrating error messages ever.
2000-04-26 20:34:28 +00:00
Guido van Rossum 14f3f59d2b Fix typo in last patch -- the symbol's name is MSG_DONWAIT, not
MSG_DONTWAIT.  Reported by Fredrik Lundh.
2000-04-25 21:53:58 +00:00