summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Repair widespread misuse of _PyString_Resize. Since it's clear peopleTim Peters2002-04-2714-90/+54
| | | | | | | | | | | | | | | | | | | | | | don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate.
* SF patch 549375: Compromise PyUnicode_EncodeUTF8Tim Peters2002-04-271-108/+70
| | | | | | | | | | | | | | | | | | | | This implements ideas from Marc-Andre, Martin, Guido and me on Python-Dev. "Short" Unicode strings are encoded into a "big enough" stack buffer, then exactly as much string space as they turn out to need is allocated at the end. This should have speed benefits akin to Martin's "measure once, allocate once" strategy, but without needing a distinct measuring pass. "Long" Unicode strings allocate as much heap space as they could possibly need (4 x # Unicode chars), and do a realloc at the end to return the untouched excess. Since the overallocation is likely to be substantial, this shouldn't burden the platform realloc with unusably small excess blocks. Also simplified uses of the PyString_xyz functions. Also added a release- build check that 4*size doesn't overflow a C int. Sooner or later, that's going to happen.
* Teach the Windows build about the new enumobject.c file.Tim Peters2002-04-261-0/+15
|
* Slightly expand and clarify the differences between getegid(), getgid(),Fred Drake2002-04-261-6/+9
| | | | | getpgrp(), and setpgid(). This closes SF bug #547939.
* Be more consistent, both internally and with recommended practice.Fred Drake2002-04-261-4/+2
| | | | This closes SF bug #547953.
* Documentation for the enumerate() function/type.Fred Drake2002-04-262-0/+55
| | | | This closes SF patch #547162.
* Clarify that the strip changes also apply to Unicode.Guido van Rossum2002-04-261-3/+3
|
* - New builtin function enumerate(x), from PEP 279. Example:Guido van Rossum2002-04-267-0/+281
| | | | | enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object.
* (py-comint-output-filter-function): Put the pop-to-buffer call insideBarry Warsaw2002-04-261-1/+1
| | | | | the `when' condition so other non-Python shell comint changes won't cause random buffers to pop.
* PyNumber_CoerceEx: this took a shortcut (not doing anything) when theGuido van Rossum2002-04-262-1/+8
| | | | | | | | | | | | | | | | | | | | | left and right type were of the same type and not classic instances. This shortcut is dangerous for proxy types, because it means that coerce(Proxy(1), Proxy(2.1)) leaves Proxy(1) unchanged rather than turning it into Proxy(1.0). In an ever-so-slight change of semantics, I now only take the shortcut when the left and right types are of the same type and don't have the CHECKTYPES feature. It so happens that classic instances have this flag, so the shortcut is still skipped in this case (i.e. nothing changes for classic instances). Proxies also have this flag set (otherwise implementing numeric operations on proxies would become nightmarish) and this means that the shortcut is also skipped there, as desired. It so happens that int, long and float also have this flag set; that means that e.g. coerce(1, 1) will now invoke int_coerce(). This is fine: int_coerce() can deal with this, and I'm not worried about the performance; int_coerce() is only invoked when the user explicitly calls coerce(), which should be rarer than rare.
* Clean up uses of some deprecated features.Fred Drake2002-04-263-17/+20
| | | | Reported by Neal Norwitz on python-dev.
* If Py_OptimizeFlag is false then always evaluate assert conditions, don'tNeil Schemenauer2002-04-262-15/+11
| | | | test __debug__ at runtime. Closes SF patch #548833.
* Make sure that tp_free frees the int the same way as tp_dealloc would.Guido van Rossum2002-04-261-0/+8
| | | | | | | | | This fixes the problem that Barry reported on python-dev: >>> 23000 .__class__ = bool crashes in the deallocator. This was because int inherited tp_free from object, which uses the default allocator. 2.2. Bugfix candidate.
* Fix typo in the setup of interpreter-mode-alist.Barry Warsaw2002-04-251-1/+1
|
* SF patch #510288 by Kevin J. Butler, mod'd by Barry. This providesBarry Warsaw2002-04-251-7/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | better auto-recognition of a Jython file vs. a CPython (or agnostic) file by looking at the #! line more closely, and inspecting the import statements in the first 20000 bytes (configurable). Specifically, (py-import-check-point-max): New variable, controlling how far into the buffer it will search for import statements. (py-jpython-packages): List of package names that are Jython-ish. (py-shell-alist): List of #! line programs and the modes associated with them. (jpython-mode-hook): Extra hook that runs when entering jpython-mode (what about Jython mode? <20k wink>). (py-choose-shell-by-shebang, py-choose-shell-by-import, py-choose-shell): New functions. (python-mode): Use py-choose-shell. (jpython-mode): New command. (py-execute-region): Don't use my previous hacky attempt at doing this, use the new py-choose-shell function. One other thing this file now does: it attempts to add the proper hooks to interpreter-mode-alist and auto-mode-alist if they aren't already there. Might help with Emacs users since that editor doesn't come with python-mode by default.
* Clean up the layout of the bool_as_number struct initializer.Guido van Rossum2002-04-251-38/+38
|
* (py-execute-region): Alexander Schmolck points out that leadingBarry Warsaw2002-04-251-0/+7
| | | | | whitespace can hose the needs-if test. So just skip all blank lines at the start of the region right off the bat.
* Pass the full pathname to MSVC when compiling a debug version. ThisThomas Heller2002-04-251-0/+6
| | | | | allows the debugger to find the source without asking the user to browse for it.
* Append the PC specific include 'PC' and library 'PCBuild' directoriesThomas Heller2002-04-251-1/+8
| | | | | | | under NT - this allows distutils to work with the CVS version or the source distribution. Wrap a long line.
* Fix trivial typo.Thomas Heller2002-04-251-1/+1
|
* (py-comint-output-filter-function): Add a pop-to-buffer call so youBarry Warsaw2002-04-251-0/+1
| | | | | always get to see the result of e.g. a py-execute-region. Funny, this bugged both me /and/ Guido!
* (py-shell-hook): A new hook variable, run at the end of py-shell.Barry Warsaw2002-04-251-0/+14
| | | | | | | | | Allows for some customization of the underlying comint buffer. (py-shell): Call the new hook. (info-lookup-maybe-add-help): A new call suggested by Milan Zamazal to make lookups in the Info documentation easier.
* Regenerated.Jack Jansen2002-04-241-4/+4
| | | | Bugfix candidate.
* Fix a small mistake and complete some function prototypes.Thomas Heller2002-04-241-4/+4
| | | | SF Patch #547813.
* Add more tests for abstract isinstance() and issubclass().Neil Schemenauer2002-04-241-4/+93
|
* test_resource has no chance of running on Windows.Tim Peters2002-04-231-0/+1
|
* test_mmap started breaking on Windows, only when run after test_bsddb.Tim Peters2002-04-231-1/+1
| | | | | | | | | On Win2K it thought 'foo' started at byte offset 0 instead of at the pagesize, and on Win98 it thought 'foo' didn't exist at all. Somehow or other this is related to the new "in memory file" gimmicks in bsddb, but the old bsddb we use on Windows sucks so bad anyway I don't want to bother digging deeper. Flushing the file in test_mmap after writing to it makes the problem go away, so good enough.
* Unit tests for the changes in abstract.c version 2.101. The debugBarry Warsaw2002-04-231-0/+144
| | | | | | build's "undetected error" problems were originally detected with extension types, but we can whitebox test the same situations with new-style classes.
* Regenerated.Jack Jansen2002-04-2320-47/+47
|
* abstract_get_bases(): Clarify exactly what the return values andBarry Warsaw2002-04-231-9/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | states can be for this function, and ensure that only AttributeErrors are masked. Any other exception raised via the equivalent of getattr(cls, '__bases__') should be propagated up. abstract_issubclass(): If abstract_get_bases() returns NULL, we must call PyErr_Occurred() to see if an exception is being propagated, and return -1 or 0 as appropriate. This is the specific fix for a problem whereby if getattr(derived, '__bases__') raised an exception, an "undetected error" would occur (under a debug build). This nasty situation was uncovered when writing a security proxy extension type for the Zope3 project, where the security proxy raised a Forbidden exception on getattr of __bases__. PyObject_IsInstance(), PyObject_IsSubclass(): After both calls to abstract_get_bases(), where we're setting the TypeError if the return value is NULL, we must first check to see if an exception occurred, and /not/ mask an existing exception. Neil Schemenauer should double check that these changes don't break his ExtensionClass examples (there aren't any test cases for those examples and abstract_get_bases() was added by him in response to problems with ExtensionClass). Neil, please add test cases if possible! I belive this is a bug fix candidate for Python 2.2.2.
* Converted to use re in stead of regex and regsub (finally:-).Jack Jansen2002-04-231-54/+65
|
* Rewrote the PyUnit description so that it now recommends to useBarry Warsaw2002-04-231-6/+16
| | | | | run_suite() instead of run_unittest(). Best practice is to plan for multiple test classes.
* Add text about circular references caused by storing frames in localFred Drake2002-04-231-0/+16
| | | | variables. This closes SF bug #543148.
* Second part of fix for #493826: regenerated suite modules so errn exists but ↵Jack Jansen2002-04-2333-1012/+687
| | | | | | == 0 doesn't signal an error. Bugfix candidate.
* First part of fix for #493826: if 'errn' key exists in return value this ↵Jack Jansen2002-04-231-1/+1
| | | | | | | | doesn't necesarily signal an error, only if the value is non-zero it does. This does not correspond with my reading of the documentation, but the OSX Finder can return 'errn'=0, and it knows better than me:-) Bugfix candidate.
* Ignore SIGXFSZ.Jeremy Hylton2002-04-231-0/+3
| | | | | | | | | | | | The SIGXFSZ signal is sent when the maximum file size limit is exceeded (RLIMIT_FSIZE). Apparently, it is also sent when the 2GB file limit is reached on platforms without large file support. The default action for SIGXFSZ is to terminate the process and dump core. When it is ignored, the system call that caused the limit to be exceeded returns an error and sets errno to EFBIG. Python always checks errno on I/O syscalls, so there is nothing to do with the signal.
* Add tests for the recent resource module change.Jeremy Hylton2002-04-232-0/+50
| | | | | | Also add a test that Python doesn't die with SIGXFSZ if it exceeds the file rlimit. (Assuming this will also test the behavior when the 2GB limit is exceed on a platform that doesn't have large file support.)
* Check for overflow errors in setrlimit(),Jeremy Hylton2002-04-231-1/+10
| | | | and reflow a long line.
* Minor change to an index entry.Fred Drake2002-04-231-1/+1
|
* Clarify return value of PyLong_AsLongLong().Jeremy Hylton2002-04-231-1/+1
| | | | | | The function is documented to return -1 on error. If res was < 0, it returned res. It wasn't clear that the invariant was res < 0 iff res == -1.
* Backport of 1.6.4.2.2.3 from release22-maint branch.Jack Jansen2002-04-231-0/+0
|
* Updated URL.Jack Jansen2002-04-231-1/+1
|
* Backport of select parts of release22-maint (up to 1.38.4.2.2.3).Jack Jansen2002-04-231-61/+21
|
* Whitespace normalization. Unka Timmy would be proud.Barry Warsaw2002-04-232-57/+57
|
* Clarify the return value of PyObject_IsInstance().Fred Drake2002-04-231-8/+9
|
* WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.Fred Drake2002-04-232-17/+113
| | | | | isatty(), WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(): Changed to return bools instead of ints.
* SF patch 546244 by John Williams: add Text.dump() method.Guido van Rossum2002-04-233-1/+41
|
* Add warning about the HP PA-RISC 2.0 C compiler's optimizer.Guido van Rossum2002-04-231-0/+5
|
* There was a non-ascii character in the source. Replaced by a hex escape.Jack Jansen2002-04-231-1/+1
|
* whitespace fixup. test__all__ and test_sundry were failingAnthony Baxter2002-04-231-1/+1
| | | | for me on linux because of the inconsistent whitespace.