Commit Graph

5677 Commits

Author SHA1 Message Date
Amaury Forgeot d'Arc 322656596a Fixed issue #4233.
Changed semantic of _fileio.FileIO's close()  method on file objects with closefd=False.
The file descriptor is still kept open but the file object behaves like a closed file.
The FileIO  object also got a new readonly attribute closefd.

Approved by Barry

Backport of r67106 from the py3k branch
2008-11-20 23:34:31 +00:00
Benjamin Peterson ad100c3acb backport r67300 2008-11-20 22:06:22 +00:00
Benjamin Peterson d3b5a7985d oops! didn't mean to disable that test 2008-11-20 21:44:23 +00:00
Benjamin Peterson 46cc6d1102 make sure that bytearray methods return a new bytearray even if there is no change
Fixes #4348
Reviewed by Brett
2008-11-19 21:49:09 +00:00
Amaury Forgeot d'Arc 7cfe7ea745 #4317: Fix an Array Bounds Read in imageop.rgb2rgb8.
Will backport to 2.4.
2008-11-18 22:19:37 +00:00
Benjamin Peterson 273c233c78 when __getattr__ is a descriptor, call it correctly; fixes #4230
patch from Ziga Seilnacht
2008-11-17 22:39:09 +00:00
Benjamin Peterson 2c98faada6 check for assignment to __debug__ during AST generation
Also, give assignment to None a better error message
2008-11-08 18:38:54 +00:00
Benjamin Peterson 81e92e582e move a FileIO test to test_fileio 2008-11-03 22:34:57 +00:00
Benjamin Peterson 6624a9fddd #4048 make the parser module accept relative imports as valid 2008-11-03 15:14:51 +00:00
Benjamin Peterson dcee09d920 make sure the parser flags and passed onto the compiler
This fixes "from __future__ import unicode_literals" in an exec statment
See #4225
2008-10-31 02:16:05 +00:00
Christian Heimes ab5f879022 Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members. 2008-10-30 21:26:15 +00:00
Amaury Forgeot d'Arc 69a9c5b539 Issue #4176: Pickle would crash the interpreter when a __reduce__ function
does not return an iterator for the 4th and 5th items.
(sequence-like and mapping-like state)

A list is not an iterator...

Will backport to 2.6 and 2.5.
2008-10-30 21:18:34 +00:00
Thomas Heller 1fac5a4505 Fixed a modulefinder crash on certain relative imports. 2008-10-30 20:18:13 +00:00
Armin Rigo 581eb1e498 Fix one of the tests: it relied on being present in an "output test" in
order to actually test what it was supposed to test, i.e. that the code
in the __del__ method did not crash.  Use instead the new helper
test_support.captured_output().
2008-10-28 17:01:21 +00:00
Benjamin Peterson 260f5bae70 add forgotten test for r67030 2008-10-26 20:33:19 +00:00
Benjamin Peterson bdca942ffc fix __future__ imports when multiple features are given 2008-10-26 20:21:13 +00:00
Benjamin Peterson 399b1fe8df give a py3k warning when 'nonlocal' is used as a variable name 2008-10-25 02:53:28 +00:00
Hirokazu Yamamoto 592c275567 Issue #4183: Some tests didn't run with pickle.HIGHEST_PROTOCOL. 2008-10-23 00:37:33 +00:00
Amaury Forgeot d'Arc fbc0b0ca29 #4157 move two test functions out of platform.py.
Turn them into unit tests, and correct an obvious typo:
    (("a", "b") ("c", "d") ("e", "f"))
compiles even with the missing commas, but does not execute very well...
2008-10-21 22:01:38 +00:00
Benjamin Peterson 77c2f93663 make sure to call iteritems() 2008-10-21 20:51:13 +00:00
Benjamin Peterson 76f71a52d7 give poplib a real test suite
#4088 from Giampaolo Rodola'x
2008-10-11 17:25:36 +00:00
Georg Brandl f3776a17ef #3935: properly support list subclasses in the C impl. of bisect.
Patch reviewed by Raymond.
2008-10-08 18:47:17 +00:00
Amaury Forgeot d'Arc d78b9dcbc3 #4069: aSet.remove(otherSet) would always report the empty frozenset([]) as the missing key.
Now it correctly refers to the initial otherset.

Reviewed by Raymond. Will backport to 2.6.
2008-10-07 20:32:10 +00:00
Hirokazu Yamamoto 39defbe6a9 more intensive test on dbm. 2008-10-07 18:10:47 +00:00
Skip Montanaro 7d9d7a2659 save/restore stdout/stderr instead of relying on __*__ versions 2008-10-07 15:03:40 +00:00
Skip Montanaro 0d8372bdb9 Simplify individual tests by defining setUp and tearDown methods. 2008-10-07 01:55:20 +00:00
Hirokazu Yamamoto 18c4e8734c More strict test. Consider the case sys.executable itself is symlink. 2008-10-06 02:41:59 +00:00
Hirokazu Yamamoto 6e5e50104c Added the test for issue3762. 2008-10-06 01:57:03 +00:00
Andrew M. Kuchling 081bb457ab Typo fix 2008-10-03 16:42:52 +00:00
Hirokazu Yamamoto b7df32e620 Fixed following error when DocXMLRPCServer failed.
UnboundLocalError: local variable 'serv' referenced before assignment
2008-10-03 16:18:42 +00:00
Andrew MacIntyre bf24401a1f fix for issue 3862: test_array fails FreeBSD 7 amd64
FreeBSD 7's underlying malloc() is behaves differently to earlier versions
and seriously overcommits available memory on amd64.  This may affect
other 64bit platforms in some circumstances, so the scale of the
problematic test is wound back.

Patch by Mark Dickinson, reviewed by Martin von Loewis.
2008-10-01 03:25:25 +00:00
Gregory P. Smith 0806749e63 Works around issue3863: freebsd4/5/6 and os2emx are known to have OS bugs when
calling fork() from a child thread.  This disables that unit test (with a note
printed to stderr) on those platforms.

A caveat about buggy platforms is added to the os.fork documentation.
2008-09-30 20:41:13 +00:00
Benjamin Peterson 8d77d448a5 fix security issue 2: imageop's poor validation of arguments could result in segfaults
patch by Victor Stinner
reviewed by myself and Brett
2008-09-30 01:31:49 +00:00
Jesse Noller 37040cdace issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller 2008-09-30 00:15:45 +00:00
Bill Janssen eb257ac97d fix for release blocker 3910, 2.6 regression in socket.ssl method 2008-09-29 18:56:38 +00:00
Brett Cannon b2d61bde28 The _lsprof module could crash the interpreter if it was given an external
timer that did not return a float and a timer was still running when the
Profiler object was garbage collected.

Fixes issue 3895.
Code review by Benjamin Peterson.
2008-09-29 03:41:21 +00:00
Benjamin Peterson e14267bbad merge in the fix for test_ftplib on some bots [reviewed by Georg] 2008-09-28 20:57:21 +00:00
Benjamin Peterson 003d7463dd enable refactor tests 2008-09-27 21:12:20 +00:00
Benjamin Peterson 3c0c483af4 give ftplib a real test suite
A asyncore based mock ftp server is used to test the protocol.
This is all thanks to Giampaolo Rodola #3939

(Barry gave me permission to do this before final on IRC.)
2008-09-27 02:49:54 +00:00
Amaury Forgeot d'Arc fc5ea39289 #3967: Correct a crash in count() and find() methods of string-like objects.
For example:
   "".count("xxxx", sys.maxint, 0)

Reviewed by Benjamin Peterson.
Will port to 2.5 and 3.0.
2008-09-26 22:34:08 +00:00
Raymond Hettinger 6ee7bc04f7 Fix namedtuple bug reported by Glenn Linderman. Template did not form correctly if the field names were input in Unicode. 2008-09-25 23:31:52 +00:00
Amaury Forgeot d'Arc 17617a07d1 #3965: on Windows, open() crashes if the filename or the mode is invalid,
and if the filename is a unicode string.

Reviewed by Martin von Loewis.
2008-09-25 20:52:56 +00:00
Benjamin Peterson a74d675fac backport the atexit test for r66563 2008-09-23 20:43:09 +00:00
Andrew MacIntyre 41c56b5ea1 build_os2emx.patch in issue 3868 - update OS/2 EMX makefile and config files
Part of source_os2emx.patch in issue 3868:
  Include/pystrcmp.h:  OS/2 has same C APIs as Windows
  Lib/test/test_io.py: OS/2 has same behaviour as Windows for this test

Reviewed by Amaury Forgeot d'Arc
2008-09-22 14:23:45 +00:00
Benjamin Peterson 2c7470d951 #3879 fix a regression in urllib.getproxies_environment
reviewers: Benjamin, Georg
2008-09-21 21:27:51 +00:00
Hirokazu Yamamoto 56d380de1d Issue #3838: TarFile object assigned to self.tar should be closed explicitly.
Reviewed by Lars Gustäbel.
2008-09-21 11:44:23 +00:00
Benjamin Peterson 8c2b7dc463 fix possible integer overflows in _hashopenssl #3886 2008-09-18 01:22:16 +00:00
Nick Coghlan d2e0938362 Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon) 2008-09-11 12:11:06 +00:00
Martin v. Löwis 4dd3a50ca4 Read unidata_version from unicodedata module.
Delete old NormalizationTest.txt if it doesn't match
unidata_version.
2008-09-10 19:16:35 +00:00
Martin v. Löwis 6d5ec2474d Update to test Unicode 5.1. 2008-09-10 18:43:49 +00:00
Guido van Rossum e3c4fd9cc0 - Issue #3629: Fix sre "bytecode" validator for an end case.
Reviewed by Amaury.
2008-09-10 14:27:00 +00:00
Martin v. Löwis 24329ba176 Issue #3811: The Unicode database was updated to 5.1.
Reviewed by Fredrik Lundh and Marc-Andre Lemburg.
2008-09-10 13:38:12 +00:00
Benjamin Peterson 97179b0f58 Fix #3634 invalid return value from _weakref.ref(Exception).__init__
Reviewers: Amaury, Antoine, Benjamin
2008-09-09 20:55:01 +00:00
Vinay Sajip 844f741039 Issue #3809: Fixed spurious 'test.blah' file left behind by test_logging. 2008-09-09 13:42:08 +00:00
Amaury Forgeot d'Arc d3ffb8974f #3777: long(4.2) returned an int, and broke backward compatibility.
the __long__ slot is allowed to return either int or long, but the behaviour of
float objects should not change between 2.5 and 2.6.

Reviewed by Benjamin Peterson
2008-09-09 07:24:30 +00:00
Brett Cannon 672237dc6c warnings.catch_warnings() now returns a list or None instead of the custom
WarningsRecorder object. This makes the API simpler to use as no special object
must be learned.

Closes issue 3781.
Review by Benjamin Peterson.
2008-09-09 00:49:16 +00:00
Hirokazu Yamamoto 631be01252 Issue #3806: LockTests in test_imp should be skipped when thread is not available.
Reviewed by Benjamin Peterson.
2008-09-08 23:38:42 +00:00
Hirokazu Yamamoto 74ce88fd67 Issue #3804: Added test for Issue #2222.
Reviewed by Benjamin Peterson.
2008-09-08 23:03:47 +00:00
Bill Janssen 61c001a939 incorporate fixes from issue 3162; SSL doc patch 2008-09-08 16:37:24 +00:00
Facundo Batista ace0bcf669 Issue 3801. Fixing a dumb error in the deprecated parse_qsl()
function.  Tests added.
2008-09-08 00:20:28 +00:00
Benjamin Peterson a853a89dc3 fix missing module 2008-09-06 23:19:15 +00:00
Amaury Forgeot d'Arc feb8cade4d #3796: A test class was not run in test_float.
Reviewed by Benjamin.
2008-09-06 20:53:51 +00:00
Antoine Pitrou 187ac1bda4 #3601: test_unicode.test_raiseMemError fails in UCS4
Reviewed by Benjamin Peterson on IRC.
2008-09-05 22:04:54 +00:00
Brett Cannon 32476fc5a8 Deprecate bsddb for removal in Python 3.0.
Closes issue 3776.
Review by Nick Coghlan.
2008-09-05 18:33:51 +00:00
Vinay Sajip 65d66e1006 Issue #3772: Fixed regression problem in StreamHandler.emit(). 2008-09-04 07:31:21 +00:00
Brett Cannon a0b7444f68 test_py3kwarn had been overlooked when test.test_support.catch_warning() was
re-implemented to use warnings.catch_warnings() and had its API improved.

Closes issue #3768.
Code review by Benjamin Peterson.
2008-09-03 22:45:11 +00:00
Facundo Batista c585df9476 Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module
to the urlparse one.  Added a PendingDeprecationWarning in the old
module, it will be deprecated in the future.  Docs and tests updated.
2008-09-03 22:35:50 +00:00
Vinay Sajip 6a2fd81316 Issue #3726: Allowed spaces in separators in logging configuration files. 2008-09-03 09:20:05 +00:00
Hirokazu Yamamoto 3e7dd78344 Issue #3759: test_asyncore.py leaked handle.
Reviewed by Amaury Forgeot d'Arc
2008-09-02 20:36:44 +00:00
Gregory P. Smith d712203d17 Issue #3708: os.urandom no longer goes into an infinite loop when passed a
non-integer floating point number.
2008-09-02 05:36:11 +00:00
Brett Cannon 1eaf0742d8 Move test.test_support.catch_warning() to the warnings module, rename it
catch_warnings(), and clean up the API.

While expanding the test suite, a bug was found where a warning about the
'line' argument to showwarning() was not letting functions with '*args' go
without a warning.

Closes issue 3602.
Code review by Benjamin Peterson.
2008-09-02 01:25:16 +00:00
Benjamin Peterson 973e6c2cf3 remove py3k warnings about the threading api; update docs
Reviewer: Benjamin Peterson
2008-09-01 23:12:58 +00:00
Amaury Forgeot d'Arc 3571fbfed7 Issue #3751: str.rpartition would perform a left-partition when called with
a unicode argument.

will backport.
2008-09-01 19:52:00 +00:00
Benjamin Peterson f22c26ecf4 #3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
2008-09-01 14:13:43 +00:00
Armin Rigo dcde494114 A collection of crashers, all variants of the idea
of issue #3720.
2008-08-29 21:21:52 +00:00
Antoine Pitrou 0668c62677 Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to
match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__
mechanism. In the process, fix a bug where isinstance() and issubclass(),
when given a tuple of classes as second argument, were looking up
__instancecheck__ / __subclasscheck__ on the tuple rather than on each
type object.

Reviewed by Benjamin Peterson and Raymond Hettinger.
2008-08-26 22:42:08 +00:00
Neal Norwitz e39be53c3c Try to reduce the flakiness of this test 2008-08-25 03:52:40 +00:00
Neal Norwitz 2a7767a173 Use bytes as return type from recv_bytes() methods. Not sure why this only
affects some buildbots.

R=Brett
TESTED=./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
2008-08-25 03:03:25 +00:00
Neal Norwitz 0c519b3a5e Fix problem reported by pychecker where AuthenticationError wasn't imported.
Add some test coverage to this code.  More tests should be added (TODO added).

R=Brett
TESTED=./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
2008-08-25 01:50:24 +00:00
Neal Norwitz 901e4715bd #3662: Fix segfault introduced when fixing memory leaks.
TESTED=./python -E -tt ./Lib/test/regrtest.py test_fileio
R (approach from bug)=Amaury and Benjamin
2008-08-24 22:03:05 +00:00
Georg Brandl 30de77b97d #3654: fix duplicate test method name. Review by Benjamin P. 2008-08-24 18:11:07 +00:00
Benjamin Peterson 712ee92309 generate py3k warnings on __getslice__, __delslice__, and __setslice__
Reviewer: Brett Cannon
2008-08-24 18:10:20 +00:00
Mark Hammond 69ed524045 Fix bug 3625: test issues on 64bit windows. r=pitrou 2008-08-23 00:59:14 +00:00
Mark Dickinson 892429b08b Fix float.fromhex test to give additional information on failure. This
change is aimed at diagnosing issue 3633 (test_float fails on Solaris).

Reviewed by Benjamin Peterson
2008-08-21 20:02:24 +00:00
Hirokazu Yamamoto cd3b74d4e8 Reverted r65900. See http://mail.python.org/pipermail/python-checkins/2008-August/073116.html 2008-08-20 16:15:28 +00:00
Hirokazu Yamamoto ccfdcd0cb2 fixed get_file_system in test_os.py ('path' is unicode on py3k and ansi on trunk) 2008-08-20 04:13:28 +00:00
Benjamin Peterson e977ad4d7b deprecate some useless, noop methods in symtable 2008-08-20 01:42:01 +00:00
Amaury Forgeot d'Arc 67f24f1ed6 follow-up of issue3473: update the compiler package to recognize the new syntax. 2008-08-20 00:08:47 +00:00
Benjamin Peterson bd6a05fe81 check that the parser module can handle the new keyword syntax 2008-08-19 22:06:11 +00:00
Benjamin Peterson 80f0ed5bb1 allow keyword args to be passed in after *args #3473 2008-08-19 19:52:46 +00:00
Jesse Noller 5bc9f4c09c issue3352: clean up the multiprocessing API to remove many get_/set_ methods and convert them to properties. Update the docs and the examples included. 2008-08-19 19:06:19 +00:00
Benjamin Peterson 6ee1a31e9b add py3k warnings for old threading APIs
they will still live in 3.0 but it can't hurt
2008-08-18 21:53:29 +00:00
Benjamin Peterson 26f521668a fix old API names in test_ssl 2008-08-18 18:39:57 +00:00
Benjamin Peterson 82aa201022 patch up multiprocessing until it's API can be changed too 2008-08-18 18:31:58 +00:00
Benjamin Peterson a9b2222de4 change a few uses of the threading APIs 2008-08-18 18:01:43 +00:00
Benjamin Peterson cbae869759 backport threading property changes 2008-08-18 17:45:09 +00:00
Benjamin Peterson d8a8972ca9 change threading.getIdent to a property
This is new in 2.6 so now need to worry about backwards compatibility :)
2008-08-18 16:40:03 +00:00
Benjamin Peterson 541f7da3a9 add a test for reduce's move 2008-08-18 02:12:23 +00:00
Antoine Pitrou 954ea64753 #3580: fix a failure in test_os 2008-08-17 20:15:07 +00:00
Benjamin Peterson 7dd854725b get the symtable module back in working order
- Fix broken functions
- Add (hopefully) extensive tests
- Modernize a little
2008-08-17 17:13:26 +00:00