Commit Graph

2354 Commits

Author SHA1 Message Date
Brett Cannon 20e192b6a6 Update for 'with' statement. 2006-03-01 20:53:08 +00:00
Brett Cannon acde7347a5 Add Misc/NEWS entry for Misc/Vim/vim_syntax.py . Also use conditional
expression for the hell of it.
2006-03-01 04:28:00 +00:00
Brett Cannon bf36409e2a PEP 352 implementation. Creates a new base class, BaseException, which has an
added message attribute compared to the previous version of Exception.  It is
also a new-style class, making all exceptions now new-style.  KeyboardInterrupt
and SystemExit inherit from BaseException directly.  String exceptions now
raise DeprecationWarning.

Applies patch 1104669, and closes bugs 1012952 and 518846.
2006-03-01 04:25:17 +00:00
Guido van Rossum 1a5e21e033 Updates to the with-statement:
- New semantics for __exit__() -- it must re-raise the exception
  if type is not None; the with-statement itself doesn't do this.
  (See the updated PEP for motivation.)

- Added context managers to:
  - file
  - thread.LockType
  - threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
  - decimal.Context

- Added contextlib.py, which defines @contextmanager, nested(), closing().

- Unit tests all around; bot no docs yet.
2006-02-28 21:57:43 +00:00
Tim Peters 84ef21c033 Its right now. 2006-02-28 20:39:06 +00:00
Neal Norwitz 055ec24bc4 Note that as generates a warning too 2006-02-28 20:06:49 +00:00
Thomas Wouters 34aa7ba114 from __future__ import with_statement addon for 'with', mostly written by
Neal.
2006-02-28 19:02:24 +00:00
Thomas Wouters fb609f4215 Wups, add NEWS item I'd written but not checked in. 2006-02-28 16:37:25 +00:00
Brett Cannon a7446e3438 Check the return code for PyErr_Warn() when warning about raising string
exceptions.  This was triggered when 'warnings' had a filter set to "error"
that caught the string exception deprecation warning.
2006-02-27 23:39:10 +00:00
Neal Norwitz 0023a2f858 Finish removal of CO_GENERATOR_ALLOWED. 2006-02-27 23:24:48 +00:00
Guido van Rossum c2e20744b2 PEP 343 -- the with-statement.
This was started by Mike Bland and completed by Guido
(with help from Neal).

This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.

There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
2006-02-27 22:32:47 +00:00
Martin v. Löwis 415ed937c2 Skip over doc strings. 2006-02-27 19:56:30 +00:00
Tim Peters f4e6928c4d Patch 1413181, by Gabriel Becedillas.
PyThreadState_Delete():  if the auto-GIL-state machinery knows about
the thread state, forget it (since the thread state is being deleted,
continuing to remember it can't help, but can hurt if another thread
happens to get created with the same thread id).

I'll backport to 2.4 next.
2006-02-27 17:15:31 +00:00
Tim Peters da1329b4f9 Trimmed trailing whitespace. 2006-02-27 16:50:01 +00:00
Neal Norwitz eb65125dda Add an entry for 308 2006-02-27 16:47:12 +00:00
Martin v. Löwis 577b5b960d Create _ast module.
Cleanup Python-ast.c generation.
2006-02-27 15:23:19 +00:00
Martin v. Löwis bd260da900 Generate code to recursively copy an AST into
a tree of Python objects. Expose this through compile().
2006-02-26 19:42:26 +00:00
Brett Cannon 23b0dc5053 Remove line meant to test trailing whitespace since that kind of whitespace is
automatically removed.

Also annotate what each line is meant to test.
2006-02-26 19:27:29 +00:00
Tim Peters d6e7e73ff8 Whitespace normalization. 2006-02-26 04:21:50 +00:00
Guido van Rossum 1968ad32cd - Patch 1433928:
- The copy module now "copies" function objects (as atomic objects).
  - dict.__getitem__ now looks for a __missing__ hook before raising
    KeyError.
  - Added a new type, defaultdict, to the collections module.
    This uses the new __missing__ hook behavior added to dict (see above).
2006-02-25 22:38:04 +00:00
Brett Cannon df95cb6ae3 Move the vimrc file to the newly created Vim/ directory. 2006-02-25 14:53:26 +00:00
Brett Cannon a4fe18227d Add a script that auto-generates a Vim syntax highlighting file for Python.
Just symlink or copy python.vim to ~/.vim/syntax/ .  Also included is a sample
Python file with basic expressions to make sure they are highlighted.

Also add a Vim directory in Misc to hold all Vim configuration files.
2006-02-25 14:52:53 +00:00
Georg Brandl dbd8339a01 Bug #854823: socketmodule now builds on Sun platforms even when
INET_ADDRSTRLEN is not defined.
2006-02-20 09:42:33 +00:00
Georg Brandl 8f7c54eaa5 Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
2006-02-20 08:40:38 +00:00
Neal Norwitz f415d5f830 Ignore the tests which report leaks sporadically.
This should cause few enough spurious warnings to send to python-checkins now.

If a test leaks that is not in the ignore list (LEAKY_TESTS), all tests
which leak will be reported.  This includes those in the ignore list.
Hopefully that will prompt someone to fix the flakiness.
2006-02-19 18:48:19 +00:00
Marc-André Lemburg fe4b34cc4b Fix the encodings package codec search function to only search
inside its own package. Fixes problem reported in patch #1433198.

Add codec search function for codec test codec.
2006-02-19 15:22:22 +00:00
Georg Brandl c98eeede17 Patch #1215184: FileInput now can be given an opening hook which can
be used to control how files are opened.
2006-02-19 14:57:47 +00:00
Georg Brandl c029f873cb Patch #1212287: fileinput.input() now has a mode parameter for
specifying the file mode input files should be opened with.
2006-02-19 14:12:34 +00:00
Georg Brandl 67e9fb9d7a Patch #1215184: fileinput now has a fileno() function for getting the
current file number.
2006-02-19 13:56:17 +00:00
Georg Brandl 602b9ba6b3 Patch #1349274: gettext.install() now optionally installs additional
translation functions other than _() in the builtin namespace.
2006-02-19 13:26:36 +00:00
Georg Brandl e466217ab9 Patch #1337756: fileinput now accepts Unicode filenames. 2006-02-19 09:51:27 +00:00
Georg Brandl f4f4415a18 Patch #1393157: os.startfile() now has an optional argument to specify
a "command verb" to invoke on the file.
2006-02-18 22:29:33 +00:00
Georg Brandl 7b4e7c24df Patch #1373643: The chunk module can now read chunks larger than
two gigabytes.
2006-02-18 21:10:56 +00:00
Georg Brandl 21dd1afde7 Add NEWS entry to previous checkin. 2006-02-17 13:35:13 +00:00
Georg Brandl bd3bc4dc4c Bug #1430298: It is now possible to send a mail with an empty
return address using smtplib.
2006-02-17 09:52:53 +00:00
Georg Brandl 0e1abe2a07 Add bug number to NEWS entry. 2006-02-17 09:48:14 +00:00
Georg Brandl 501dd0dd9d The names of lambda functions are now properly displayed in pydoc. 2006-02-17 09:45:40 +00:00
Martin v. Löwis 86d662602d Patch #1432345: Make python compile on DragonFly. 2006-02-17 08:40:11 +00:00
Martin v. Löwis 18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Neal Norwitz 79415523d6 Find test failures consistently 2006-02-15 06:07:32 +00:00
Martin v. Löwis 856bf9a4e9 Add build support for AMD64. 2006-02-14 20:42:55 +00:00
Neal Norwitz 88b78d8cd4 Support 2.4 (released versions) better. (rsync was not working with adding the *. Only some files/dirs were copied, not everything.) 2006-02-14 08:14:16 +00:00
Martin v. Löwis a55e55e9f3 Patch #428494: Prefer linking against ncursesw over ncurses library 2006-02-11 15:55:14 +00:00
Georg Brandl b69406dc09 Update general copyright years to 2006. 2006-02-11 15:30:36 +00:00
Neal Norwitz bd3490abdb Be a little less sensitive to failures. Only check for the result from
regrtest.py.  If we grep for just "fail", that finds bsddb deadlock
messages, which presumably are just warnings.  They don't cause
a test failure.
2006-02-09 05:08:56 +00:00
Armin Rigo a871ef2b3e Added the cProfile module.
Based on lsprof (patch #1212837) by Brett Rosen and Ted Czotter.
With further editing by Michael Hudson and myself.
History in svn repo: http://codespeak.net/svn/user/arigo/hack/misc/lsprof

* Module/_lsprof.c is the internal C module, Lib/cProfile.py a wrapper.
* pstats.py updated to display cProfile's caller/callee timings if available.
* setup.py and NEWS updated.
* documentation updates in the profiler section:
   - explain the differences between the three profilers that we have now
   - profile and cProfile can use a unified documentation, like (c)Pickle
   - mention that hotshot is "for specialized usage" now
   - removed references to the "old profiler" that no longer exists
* test updates:
   - extended test_profile to cover delicate cases like recursion
   - added tests for the caller/callee displays
   - added test_cProfile, performing the same tests for cProfile
* TO-DO:
   - cProfile gives a nicer name to built-in, particularly built-in methods,
     which could be backported to profile.
   - not tested on Windows recently!
2006-02-08 12:53:56 +00:00
Neal Norwitz 082b2df33f Bug #876637, prevent stack corruption when socket descriptor
is larger than FD_SETSIZE.

This can only be acheived with ulimit -n SOME_NUMBER_BIGGER_THAN_FD_SETSIZE
which is typically only available to root.  Since this wouldn't normally
be run in a test (ie, run as root), it doesn't seem too worthwhile to
add a normal test.  The bug report has one version of a test.  I've
written another.  Not sure what the best thing to do is.

Do the check before calling internal_select() because we can't set
an error in between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS.
This seemed the clearest solution, ie handle before calling internal_select()
rather than inside.  Plus there is at least one place outside
of internal_select() that needed to be handled.

Will backport.
2006-02-07 07:04:46 +00:00
Martin v. Löwis 0075690ced Patch #1412872: zipfile: use correct system type on unixy systems. 2006-02-05 17:09:41 +00:00
Neal Norwitz 0e6bc8c260 Patch #1407135, bug #1424041, make mmap.mmap(-1, length) work the same
on both Unix (SVR4 and BSD) and Windows.  Restores behaviour of passing -1
for anonymous memory on Unix.  Use MAP_ANONYMOUS instead of _ANON since
the latter is deprecated according to Linux (gentoo) man pages.

Should we continue to allow mmap.mmap(0, length) to work on Windows?
0 is a valid fd.

Will backport bugfix portions.
2006-02-05 05:45:43 +00:00
Martin v. Löwis 57a34e8026 Patch #1422385: Changes to nis module to support multiple NIS domains 2006-02-04 19:12:37 +00:00