Commit Graph

21844 Commits

Author SHA1 Message Date
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
Tim Peters e085017ab7 _PyMalloc_DebugRealloc(): simplify decl of "fresh".
Assorted:  bump the serial number via a trivial new bumpserialno()
function.  The point is to give a single place to set a breakpoint when
waiting for a specific serial number.
2002-03-24 00:34:21 +00:00
Neil Schemenauer f06f8530f1 Use linecache for loading source code. Closes SF patch 490374. 2002-03-23 23:51:04 +00:00
Neil Schemenauer dbab3e3178 Add namespace selection for rlcompleter. Closes SF patch 490026. 2002-03-23 23:44:51 +00:00
Tim Peters 62c06ba6a9 Minor code cleanup -- no semantic changes. 2002-03-23 22:28:18 +00:00
Neil Schemenauer 194152845c Fix example for PyErr_SetFromErrno() (need to pass exception type). 2002-03-23 20:57:11 +00:00
Neil Schemenauer 0f2103fb16 Fix wording of sys.exit docstring. Close SF bug 534113. 2002-03-23 20:46:35 +00:00
Neil Schemenauer d03c342b99 Flush stdout before reading next command. Closes SF bug 526357. 2002-03-23 20:43:59 +00:00
Neil Schemenauer 3a204a7e48 Grow the string buffer at a mildly exponential rate for the getc version
of get_line.  This makes test_bufio finish in 1.7 seconds instead of 57
seconds on my machine (with Py_DEBUG defined).

Also, rename the local variables n1 and n2 to used_v_size and
total_v_size.
2002-03-23 19:41:34 +00:00
Tim Peters ddea208be9 Give Python a debug-mode pymalloc, much as sketched on Python-Dev.
When WITH_PYMALLOC is defined, define PYMALLOC_DEBUG to enable the debug
allocator.  This can be done independent of build type (release or debug).
A debug build automatically defines PYMALLOC_DEBUG when pymalloc is
enabled.  It's a detected error to define PYMALLOC_DEBUG when pymalloc
isn't enabled.

Two debugging entry points defined only under PYMALLOC_DEBUG:

+ _PyMalloc_DebugCheckAddress(const void *p) can be used (e.g., from gdb)
  to sanity-check a memory block obtained from pymalloc.  It sprays
  info to stderr (see next) and dies via Py_FatalError if the block is
  detectably damaged.

+ _PyMalloc_DebugDumpAddress(const void *p) can be used to spray info
  about a debug memory block to stderr.

A tiny start at implementing "API family" checks isn't good for
anything yet.

_PyMalloc_DebugRealloc() has been optimized to do little when the new
size is <= old size.  However, if the new size is larger, it really
can't call the underlying realloc() routine without either violating its
contract, or knowing something non-trivial about how the underlying
realloc() works.  A memcpy is always done in this case.

This was a disaster for (and only) one of the std tests:  test_bufio
creates single text file lines up to a million characters long.  On
Windows, fileobject.c's get_line() uses the horridly funky
getline_via_fgets(), which keeps growing and growing a string object
hoping to find a newline.  It grew the string object 1000 bytes each
time, so for a million-character string it took approximately forever
(I gave up after a few minutes).

So, also:

fileobject.c, getline_via_fgets():  When a single line is outrageously
long, grow the string object at a mildly exponential rate, instead of
just 1000 bytes at a time.

That's enough so that a debug-build test_bufio finishes in about 5 seconds
on my Win98SE box.  I'm curious to try this on Win2K, because it has very
different memory behavior than Win9X, and test_bufio always took a factor
of 10 longer to complete on Win2K.  It *could* be that the endless
reallocs were simply killing it on Win2K even in the release build.
2002-03-23 10:03:50 +00:00
Skip Montanaro 91cc17d20e Only AttributeError can be raised in this situation - on systems without
getuid or getpid.  posix_getuid & posix_getpid never raise exceptions when
called with no args.
2002-03-23 05:58:52 +00:00
Skip Montanaro 3c4a629bdc import statements only raise ImportError, right? 2002-03-23 05:55:18 +00:00
Skip Montanaro db5d1444a1 tighten up except - only ValueError can be raised in this situation 2002-03-23 05:50:17 +00:00
Skip Montanaro 3c643d8db3 tighten up except - int() only raises ValueError 2002-03-23 05:47:31 +00:00
Skip Montanaro 6ec967d066 added RFC 2396 tests from Aaron Swartz included in bug # 450225.
converted to use unittest
2002-03-23 05:32:10 +00:00
Skip Montanaro b1ba6b0044 no longer needed - converted test_urlparse.py to use unittest 2002-03-23 05:29:59 +00:00
Tim Peters 0c2c8e77fb SF bug 533234: tm_isdst > 1 Passed to strftime.
One more time on this turkey, but duller instead of cleverer.

Curious:  The docs say __getslice__ has been deprecated since 2.0, but
list.__getitem__ still doesn't work if you pass it a slice.  This makes
it a lot clearer to emulate a list by *being* a list <wink>.

Bugfix candidate.  Michael, just pile this patch on top of the others
that went by -- no need to try to pick these apart.
2002-03-23 03:26:53 +00:00
Neil Schemenauer ed19b88f0b Check in (hopefully) corrected version of last change. 2002-03-23 02:06:50 +00:00
Tim Peters ce7fb9b515 Just whitespace fiddling. 2002-03-23 00:28:57 +00:00
Tim Peters 1221c0a435 Build obmalloc.c directly instead of #include'ing from object.c.
Also move all _PyMalloc_XXX entry points into obmalloc.c.

The Windows build works fine.
The Unix build is changed here (Makefile.pre.in), but not tested.
No other platform's build process has been fiddled.
2002-03-23 00:20:15 +00:00
Neil Schemenauer c24ea08644 Disable the parser hacks that enabled the "yield" keyword using a future
statement.
2002-03-22 23:53:36 +00:00
Neil Schemenauer 12a6d942d8 Undo last commit. It's causing the tests to file. 2002-03-22 23:50:30 +00:00
Neil Schemenauer c155dd4ca9 Disable the parser hacks that allowed the "yield" keyword to be enabled
by a future statement.
2002-03-22 23:38:11 +00:00
Neil Schemenauer 558ba52f10 Remove malloc hooks. 2002-03-22 23:20:15 +00:00
Neil Schemenauer fa79c65235 Match behavior of the pickle.py module more closely. 2002-03-22 23:02:53 +00:00
Neil Schemenauer 79f181395b Add more example exceptions that unpickling can raise. 2002-03-22 22:16:03 +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 398b9f6d6d Disallow open()ing of directories. Closes SF bug 487277. 2002-03-22 20:38:57 +00:00
Skip Montanaro 07c57d4e60 better solution for bug #533234 courtesy of Tim.
Michael: use this version as the bugfix candidate...
2002-03-22 18:35:51 +00:00
Skip Montanaro e8c6a3eef6 guarantee that the dst flag of synthetic "time" tuples passed to strftime
is always 0.  This closes bug #533234.
2002-03-22 18:07:49 +00:00
Walter Dörwald 92b48b739f use stat attributes instead of tuple entries
and remove the unneccessary "import stat" statement.
2002-03-22 17:30:38 +00:00
Fred Drake cf43004b83 Fix broken HTML in the head; this was reported by a user as causing Opera 6.01
to crash.  The user has reported the problem to Opera, but we still should
generate something that passes for HTML.
2002-03-22 17:22:38 +00:00
Neil Schemenauer 9d50d138e7 Add news about pymalloc being enabled. 2002-03-22 17:06:59 +00:00
Neil Schemenauer 1b0e4fcc29 Use pymalloc for realloc() as well. 2002-03-22 15:41:03 +00:00
Andrew M. Kuchling b26ca9db2e Revert part of previous patch: several install_* subcommands expect
.compile to be None, and set it to true if it is.
    Caught by Pearu Peterson.

Bugfix candidate, if the previous change is accepted for
release22-maint.
2002-03-22 15:35:17 +00:00
Neil Schemenauer 16c22976c3 Enable pymalloc by default. 2002-03-22 15:34:49 +00:00
Neil Schemenauer dcc819a5c9 Use pymalloc if it's enabled. 2002-03-22 15:33:15 +00:00
Neil Schemenauer a1a9c51a3e Add pymalloc object memory management functions. These must be
available even if pymalloc is disabled since extension modules might use
them.
2002-03-22 15:28:30 +00:00
Neil Schemenauer ffd5399728 Make PyObject_{NEW,New,Del,DEL} always use the standard malloc (PyMem_*)
and not pymalloc.  Add the functions PyMalloc_New, PyMalloc_NewVar, and
PyMalloc_Del that will use pymalloc if it's enabled.   If pymalloc is
not enabled then they use the standard malloc (PyMem_*).
2002-03-22 15:25:18 +00:00
Jack Jansen 150ed6113c Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
don't cause import failure.

Fixes 531398, 2.2.1 candidate.
2002-03-22 14:16:39 +00:00
Jack Jansen 9051e0e577 - Weaklink InterfaceLib in _Res module
- forgot to pass libraryflags and stdlibraryflags on to ppc/carbon
  project generation.

First half of fix to 531398.
2002-03-22 14:15:07 +00:00
Tim Peters b26f3639ed Enable pymalloc by default in the Windows build. 2002-03-22 06:32:32 +00:00
Andrew M. Kuchling 76fffd81e9 Add a simple test suite for netrc.py, and remove it from test_sundry 2002-03-22 02:48:57 +00:00
Tim Peters bab22beda8 SF bug 533198: Complex power underflow raises exception.
Konrad was too kind.  Not only did it raise an exception, the specific
exception it raised made no sense.  These are old bugs in complex_pow()
and friends:

1. Raising 0 to a negative power isn't a range error, it's a domain
   error, so changed c_pow() to set errno to EDOM in that case instead
   of ERANGE.

2. Changed complex_pow() to:

A. Used the Py_ADJUST_ERANGE2 macro to try to clear errno of a spurious
   ERANGE error due to underflow in the libm pow() called by c_pow().

B. Produced different exceptions depending on the errno value:
   i) For errno==EDOM, raise ZeroDivisionError instead of ValueError.
      This is for consistency with the non-complex cases 0.0**-2 and
      0**-2 and 0L**-2.
   ii) For errno==ERANGE, raise OverflowError.

Bugfix candidate.
2002-03-22 02:48:46 +00:00
Andrew M. Kuchling 366a1df7f1 [Bug #532115] netrc module was broken
* 'macdef' (macro definition) wasn't parsed correctly
   * account value not reset for a subsequent 'default' line
   * typo: 'whitepace' -> 'whitespace'

Bugfix candidate.
2002-03-22 02:46:41 +00:00
Andrew M. Kuchling 83d042d3a7 [Bug #532136] Change path in README, as suggested by Ralph Corderoy
Bugfix candidate.
2002-03-21 23:52:20 +00:00
Andrew M. Kuchling 3f1822b468 Add missing Boolean options
Remove unused no_compile flag
Initialize the Boolean attribute .compile to 0 instead of None

Bugfix candidate.
2002-03-21 23:46:54 +00:00
Andrew M. Kuchling da9f0bf4dd Add unlisted Boolean options. Thomas H., can you please check that I
got this right?

Bugfix candidate, unless Thomas notes a problem.
2002-03-21 23:44:01 +00:00
Andrew M. Kuchling 5de82a855e [Bug #517451] bdist_rpm didn't list all of its Boolean options.
(Someone should check the other commands for this same error.)

Bugfix candidate.
2002-03-21 23:27:54 +00:00
Jack Jansen 562baabb61 Added an open_pathname() method which opens a resource file by pathname,
possibly converting from AppleSingle.
2002-03-21 22:38:32 +00:00