Commit Graph

14996 Commits

Author SHA1 Message Date
Georg Brandl 96a60ae90c #1682942: add some ConfigParser features: alternate delimiters, alternate comments, empty lines in values. Also enhance the docs with more examples and mention SafeConfigParser before ConfigParser. Patch by Lukas Langa, review by myself, Eric and Ezio. 2010-07-28 13:13:46 +00:00
Georg Brandl cbb0ae4a42 #9354: Provide getsockopt() in asyncore file_wrapper(). Patch by Lukas Langa. 2010-07-28 08:19:35 +00:00
Ezio Melotti 84befb00bd Fix failure introduced in r83182. 2010-07-28 00:23:21 +00:00
Victor Stinner cf448832eb Issue #8966: ctypes: Remove implicit bytes-unicode conversion 2010-07-28 00:15:03 +00:00
Victor Stinner 42746df17b Fix ctypes tests to avoid implicit bytes-unicode conversion 2010-07-27 23:36:41 +00:00
Alexander Belopolsky 455f7bdc05 Issue #9378: python -m pickle <pickle file> will now load and display
the first object in the pickle file.
2010-07-27 23:02:38 +00:00
Ezio Melotti 9a381c7a02 With skipUnless there is no need to add test classes conditionally. 2010-07-27 22:24:13 +00:00
Ezio Melotti 63c4640327 Use proper skips and assert* methods in test_asyncore. 2010-07-27 22:03:33 +00:00
Florent Xicluna f1046ca817 Issue #4770: Restrict binascii module to accept only bytes (as specified).
And fix the email package to encode to ASCII instead of ``raw-unicode-escape`` before ASCII-to-binary decoding.
2010-07-27 21:20:15 +00:00
Alexander Belopolsky c02cc2707a Issue #9384: python -m tkinter will now display a simple demo applet. 2010-07-27 14:16:32 +00:00
Gregory P. Smith 5a63183a8b The default size of the re module's compiled regular expression cache has
been increased from 100 to 500 and the cache replacement policy has changed
from simply clearing the entire cache on overflow to randomly forgetting 20%
of the existing cached compiled regular expressions.  This is a performance
win for applications that use a lot of regular expressions and limits the
impact of the performance hit anytime the cache is exceeded.
2010-07-27 05:31:29 +00:00
Alexander Belopolsky aeb039863d Make python version of fromtimestamp behave more like C. 2010-07-26 02:36:41 +00:00
Brian Curtin 9a27b0cd19 Fix #7113. Patch by Łukasz Langa.
Changes include using a list of lines instead of patching together using
string interpolation, and a multi-line value test cases.
2010-07-26 00:27:10 +00:00
Andrew M. Kuchling 688b9e384e #777884: make .normalize() do nothing for childless nodes, instead of raising an exception 2010-07-25 23:38:47 +00:00
Michael Foord bd6c079552 Issue #4686 - add .args to exceptions in the configparsermodule 2010-07-25 23:09:25 +00:00
Alexander Belopolsky 07de165d6e Corrected comments on where settrace and setprofile are tested. 2010-07-25 15:05:42 +00:00
Alexander Belopolsky 13c475385b Issue #9315: Renamed test_trace to test_sys_settrace and
test_profilehooks to test_sys_setprofile so that test_trace can be
used for testing the trace module and for naming consistency.
2010-07-25 15:02:55 +00:00
Alexander Belopolsky f6d2ca06ac Issue #9315: Revert r83005 before renaming test_trace to
test_sys_settrace and test_profilehooks to test_sys_setprofile in all
three branches.
2010-07-25 14:58:54 +00:00
Ronald Oussoren cb615e6abe Fix for issue 9367: the test code for os.getgroups
assumes that the result of getgroups and the output
of the id(1) command return groups in the same
order.  That assumption is both fragile and false.
2010-07-24 14:15:19 +00:00
Richard Jones 803ef8a694 Implementation for issue 4184
Changes the previously private attributes to make them public, increasing the potential for extending the library in user code. Backward-compatible and documented.
2010-07-24 09:51:40 +00:00
Victor Stinner 756f547b9a #9032: XML-RPC client: Transport.request() retries on EPIPE error
The EPIPE error occurs when the server closes the socket and the client sends a
"big" XML-RPC request (I don't know exactly the size threshold).

request() just have to ignore the error because single_request() closes the
socket on error, and so the next call to single_request() will open a new
socket.

Remove also a comment in the HTTP client because it's now wrong: see r70643
and issue #5542.
2010-07-24 02:24:55 +00:00
Victor Stinner eccc5facd3 Issue #4629: getopt raises an error if an argument ends with = whereas getopt
doesn't except a value (eg. --help= is rejected if getopt uses ['help='] long
options).
2010-07-24 00:49:20 +00:00
Alexander Belopolsky a565874cc1 Use _datetime docstring if _datetime is available. 2010-07-23 20:03:53 +00:00
Alexander Belopolsky cf86e368eb Issue #7989: Added pure python implementation of the datetime module. 2010-07-23 19:25:47 +00:00
Brett Cannon 671153db25 Add queue tests for empty, full, put_nowait, and get_nowait.
Closes issue 9357. Thanks to Brian Brazil for the patch.
2010-07-23 16:56:21 +00:00
Ezio Melotti 6086118ced #9359: fix typo. Thanks to Piotr Kasprzyk for the patch. 2010-07-23 16:48:22 +00:00
Brian Curtin 81a4a6abb7 Tab test_repr_daemon over so it's included in ThreadTests.
Noticed by Amaury.
2010-07-23 16:30:10 +00:00
Brett Cannon 4b16e130cc Add tests for fnmatch.filter and translate.
Partially closes issue 9356. Thanks to Brian Brazil for the patch.
2010-07-23 16:23:13 +00:00
Brett Cannon cc14320159 Make fnmatch be more PEP 8 compliant.
Partially closes issue 9356. Thanks to Brian Brazil for the patch.
2010-07-23 16:22:25 +00:00
Richard Jones 8cb3619f86 New tests for smtpd module. Has full coverage for SMTPChannel and SMTPServer. 2010-07-23 16:20:40 +00:00
Brett Cannon 3f5f226ba0 Add more tests for the threading.Thread.repr.
Partially closes issue 9346. Thanks to Brian Brazil for the patch.
2010-07-23 15:50:52 +00:00
Brett Cannon 148724d39b Rip out old testing code that was inlined in threading.
Partially closes issue 9346. Thanks Brian Brazil for the patch.
2010-07-23 15:50:02 +00:00
Brett Cannon 42e54b29b9 Stop shadowing a test class. 2010-07-23 14:45:19 +00:00
Brett Cannon 1f27479e26 Explicitly test relative imports by reusing importlib tests.
Closes issue 8392. Thanks Virgil Dupras for the initial patch.
2010-07-23 14:03:16 +00:00
Brett Cannon cfae36fa8e Test calendar.monthrange.
Closes issue 9342. Thanks John Chandler for the patch.
2010-07-23 13:54:14 +00:00
Ronald Oussoren b6ee4f5bfc This fixes issue7900 by adding code that deals
with the fact that getgroups(2) might return
more that MAX_GROUPS on OSX.

See the issue (and python-dev archives) for the
gory details. Summarized: OSX behaves rather oddly
and Apple says this is intentional.
2010-07-23 13:53:51 +00:00
Martin v. Löwis c9e1c7d97f Issue #6095: Make directory argument to os.listdir optional.
Patch by Virgil Dupras.
2010-07-23 12:16:41 +00:00
Ronald Oussoren e186e384f4 Fix for issue 7895. Avoid crashing the interpreter
when calling platform.mac_ver after calling os.fork by
reading from a system configuration file instead of
using OSX APIs.
2010-07-23 11:54:59 +00:00
Ronald Oussoren c3960c28b0 Minor tweak of test_osx_env to
avoid failing when the framework is not
yet installed.
2010-07-23 11:48:36 +00:00
Ronald Oussoren 102d11a6d6 Workaround for issue 4047: in some configurations of
the Crash Reporter on OSX test_subprocess will trigger
the reporter.

This patch prints a warning when the Crash Reporter will
get triggered intentionally, which should avoid confusing
people.
2010-07-23 09:50:05 +00:00
Ronald Oussoren e8d252dbcb Ensure that the Makefile variable expansion
in distutils.sysconfig matches that in the
toplevel sysconfig module.

Without this patch universal builds on OSX are
broken.

Als add a test that checks that the two version
of get_config_vars agree on important values.
2010-07-23 09:43:17 +00:00
Georg Brandl 599b65deca Use augassign. 2010-07-23 08:46:35 +00:00
Brian Curtin db902ac0b4 Skip this test as it doesn't apply to Windows. It was added for
#9189 for some GCC flags.
2010-07-22 15:38:28 +00:00
Tarek Ziadé 3679727939 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen. 2010-07-22 12:50:05 +00:00
Brett Cannon 5db0c94072 Add importlib benchmarks which try to be "realistic" by importing the decimal
module which is the largest module in the stdlib.
2010-07-22 07:40:56 +00:00
Alexander Belopolsky 3f8ecab589 Issue #9323: Fixed a bug in trace.py that resulted in loosing the name
of the script being traced.  Patch by Eli Bendersky.
2010-07-21 17:43:42 +00:00
Antoine Pitrou 8cb6dbf1b9 Issue #5395: check that array.fromfile() re-raises an IOError instead of replacing it
with EOFError.
(this is only an added test, but 2.x will get a fix too)
2010-07-21 16:41:31 +00:00
Doug Hellmann 1c524754f6 Apply patch from Ray Allen for issue 9296 2010-07-21 12:29:04 +00:00
Benjamin Peterson 20f9c3c50f revert unintended changes 2010-07-20 22:39:34 +00:00
Benjamin Peterson 013783c529 move test_trace.py so as not to conflict with future tests for the trace module 2010-07-20 22:37:19 +00:00
Alexander Belopolsky 533a167a71 Issue #9282: Fixed --listfuncs option of trace.py. Thanks Eli
Bendersky for the patch.
2010-07-20 19:55:18 +00:00
Ronald Oussoren d21886cea4 Without this patch the value of sysconfig.get_config_var('LDSHARED')
is wrong when PY_LDFLAGS is not empty.

The bug was caused by LDSHARED getting expanded *before* sysconfig
renamed PY_LDSHARED (and simular values) to names without a PY_
prefix.

The patch tries to maintain the intended behaviour of allowing users
to set LDFLAGS in the environment and have that affect the build.

Without this patch a universal build on OSX cannot build universal
(fat binary) extensions.
2010-07-20 16:07:10 +00:00
Gregory P. Smith 41e6c3df8b Fixes Issue #3704: http.cookiejar was not properly handling URLs with a / in
the parameters.  (This is jjlee's issue3704.patch ported to py3k)
2010-07-19 23:17:22 +00:00
Senthil Kumaran 79e17f6f66 Fix Issue9301 - urllib.parse.unquote and unquote_to_byte to raise TypeError for None. 2010-07-19 18:17:19 +00:00
Stefan Krah 99212f61db Sub-issue of #9036: Fix incorrect use of Py_CHARMASK. 2010-07-19 17:58:26 +00:00
Stefan Krah 9542cc6eb5 Issue #9265: Incorrect name passed as arg[0] when shell=True
and executable specified.
2010-07-19 14:20:53 +00:00
Ronald Oussoren f4ebe2e8a0 This patch adds a testcase that demonstrates a problem
with the expansion of LDSHARED when accessing that value
through sysconfig.

The problem is probably caused by the 9189.

A fix will follow shortly.
2010-07-19 13:00:36 +00:00
Georg Brandl 55353ca6dc pydoc.pager does not promise to use $PAGER. 2010-07-19 08:02:46 +00:00
Georg Brandl 02053ee3b9 #9279: remove the pdb.doc file, put its contents in pdb.__doc__. Also sync this and the pdb docs, introduce a new directive for pdb commands and a role to link to them. 2010-07-18 10:11:03 +00:00
Alexander Belopolsky d92f04062a Issue #5180: Fixed a bug that prevented loading 2.x pickles in 3.x
python when they contain instances of old-style classes.
2010-07-17 22:50:45 +00:00
Alexander Belopolsky 929d384058 Issue #9268: Add annotation option to pickletools.dis 2010-07-17 15:51:21 +00:00
R. David Murray 45bf773f60 #1555570: correctly handle a \r\n that is split by the read buffer.
Patch and test by Tony Nelson.
2010-07-17 01:19:57 +00:00
Brett Cannon cbe1a4e28f Add comma grouping to max result so it's easier to read. 2010-07-16 19:26:23 +00:00
Antoine Pitrou 448acd0a3f Fix possible failure in pickling tests due to different instantiations
of the random module being around.
2010-07-16 19:10:38 +00:00
Brett Cannon 3b0a19eaba Add benchmarks for importing just source w/o writing bytecode, importing source
while writing bytecode, and importing bytecode with source existing (don't care
about sourceless imports).
2010-07-16 19:04:29 +00:00
Alexander Belopolsky 44c2ffd38f Corrected TUPLE<N> opcodes' docs. 2010-07-16 14:39:45 +00:00
Brett Cannon 7b9bcb8411 Touch up comments and code along with outputting what the unit of measure is. 2010-07-15 06:24:04 +00:00
Senthil Kumaran 04f31b8ae6 Fix a mistake, https proxy shoud be https:// 2010-07-14 20:10:52 +00:00
Senthil Kumaran e4004a653c Fix: Issue6853 - Get HTTPS system proxy in Windows. 2010-07-14 19:15:23 +00:00
Alexander Belopolsky 4988d7a375 PEP 8 conformance: class_ -> cls 2010-07-14 13:46:57 +00:00
Antoine Pitrou 1f9dea0b5f Issue #9251: test_threaded_import didn't fail when run through regrtest
if the import lock was disabled.
2010-07-14 11:52:38 +00:00
Senthil Kumaran aa69d4d00f Fix Issue5842 - Moving the tests out of urllib.parse module 2010-07-14 10:21:22 +00:00
Victor Stinner 996903120c Woops, test_sndhdr.py contains the same code twice: fix it 2010-07-13 23:08:01 +00:00
Victor Stinner e9ebde48cf Issue #9243: Fix sndhdr module and add unit tests, contributed by James Lee. 2010-07-13 23:04:56 +00:00
Alexander Belopolsky 903396ee66 Set sys.modules[name] to None instead of 0 to block module import. 2010-07-13 14:50:16 +00:00
Mark Dickinson 94628eeb58 Yield more information on failure in test_struct boolean test. 2010-07-12 20:03:24 +00:00
Ezio Melotti 2efaf96771 #6026: skip test_get_file_list when zlib is not available. 2010-07-12 19:49:41 +00:00
Benjamin Peterson 5ef96e5fac allow byte literals 2010-07-11 23:06:06 +00:00
Mark Dickinson 68c5de6d1c assertEquals -> assertEqual 2010-07-11 19:12:10 +00:00
Mark Dickinson b214e90e01 Issue #9137: Fix issue in MutableMapping.update, which incorrectly
treated keyword arguments called 'self' or 'other' specially.
2010-07-11 18:53:06 +00:00
Mark Dickinson 8e0c996873 Issue #9165: Add math.isfinite and cmath.isfinite. 2010-07-11 17:38:24 +00:00
Benjamin Peterson 3e7428995f test for set literals 2010-07-11 12:59:24 +00:00
Georg Brandl 492f3fc272 Allow set literals in literal_eval(). 2010-07-11 09:41:21 +00:00
Ronald Oussoren d3950527e7 Fix for issue 9164 2010-07-11 09:05:07 +00:00
Senthil Kumaran 2ef16328e8 Stricter verification for file based url scheme and reliance on ftp protocol. 2010-07-11 03:12:43 +00:00
Benjamin Peterson 0d62f5bbfe ValueError is eventually what we want to move to, I suppose 2010-07-10 15:14:45 +00:00
Michael Foord c653ce313f Fix error message for comparing single line strings in unittest.TestCase.assertEqual.
Issue 9174.
2010-07-10 13:52:22 +00:00
R. David Murray 0425a8ea72 Fix 'refleak' introduced by fnmatch cache purge tests.
This introduces a 'purge' function for the fnmatch module analogous
to the 'purge' function in the re module.
2010-07-10 13:52:13 +00:00
Georg Brandl 297d97241a #1434090: properly append child in expatbuilder doctype handler. 2010-07-10 11:40:13 +00:00
Georg Brandl 0310a83e7f #3071: tell how many values were expected when unpacking too many. 2010-07-10 10:32:36 +00:00
Jeffrey Yasskin 61c061a8b3 Oops. Fix distutils tests that r82746 broke. 2010-07-09 19:55:05 +00:00
Benjamin Peterson b669221bd1 be more robust across platforms 2010-07-09 19:37:00 +00:00
Benjamin Peterson 34d17debb7 remove SocketIO.__del__; close() can handle it 2010-07-09 18:28:25 +00:00
Jeffrey Yasskin d4fcdb1ea8 Issue #9189: Allow users to set $CFLAGS, $CPPFLAGS, and $LDFLAGS when running
configure to append to Python's default values for those variables, and
similarly allow users to set $XXFLAGS on the make command line to append to the
values set by configure.

In the makefile, this renames the variables that used to be $XXFLAGS to
$PY_XXFLAGS, and renames the old $PY_CFLAGS to $PY_CORE_CFLAGS.  To compensate,
sysconfig now aliases $XXFLAGS=$PY_XXFLAGS so that scripts using it keep
working.  I see that as the right interface, not a backward-compatibility hack,
since these are logically the $XXFLAGS variables; we just use a different name
in the makefile to deal with make's semantics.
2010-07-09 16:30:58 +00:00
Brian Curtin 74e4561a3c Re-flow several long lines from #1578269. 2010-07-09 15:58:59 +00:00
Brian Curtin 16633fa497 Fix the breakage of Lib/tarfile.py on non-Windows platforms due to
using WindowsError in a try/except. Only add WindowsError to the list of
exceptions to catch when we are actually running on Windows.

Additionally, add a call that was left out in test_posixpath.

Thanks Amaury, Antoine, and Jason.
2010-07-09 13:54:27 +00:00
Benjamin Peterson 4b83af9576 wrap 2010-07-09 13:31:11 +00:00
Benjamin Peterson a04a32d586 allow more exceptions 2010-07-09 13:28:42 +00:00
Benjamin Peterson ccbcf53865 OverflowError is fine 2010-07-09 13:20:40 +00:00
R. David Murray ea340a317a 7846: limit fnmatch pattern cache to _MAXCACHE=100 entries.
Patch by Andrew Clegg.
2010-07-09 12:23:21 +00:00
Benjamin Peterson 8b0ef21c15 use assert method 2010-07-09 01:58:26 +00:00
Benjamin Peterson d02441ea2f fix repr of complicated structseqs #9206 2010-07-08 22:33:03 +00:00
Benjamin Peterson 8c567c540d assert tuple inheritance 2010-07-08 22:16:05 +00:00
Brian Curtin 808e1ada94 Undo inadvertant checkin. 2010-07-08 22:13:25 +00:00
Brian Curtin d40e6f70a5 Implement #1578269. Patch by Jason R. Coombs.
Added Windows support for os.symlink when run on Windows 6.0 or greater,
aka Vista. Previous Windows versions will raise NotImplementedError
when trying to symlink.

Includes numerous test updates and additions to test_os, including
a symlink_support module because of the fact that privilege escalation
is required in order to run the tests to ensure that the user is able
to create symlinks. By default, accounts do not have the required
privilege, so the escalation code will have to be exposed later (or
documented on how to do so). I'll be following up with that work next.

Note that the tests use ctypes, which was agreed on during the PyCon
language summit.
2010-07-08 21:39:08 +00:00
Mark Dickinson 0dd8f7890a Issue #9136: Profiling Decimal gave 'dictionary changed size during iteration'.
Remove the use of locals() that caused this error.
2010-07-08 21:15:36 +00:00
Mark Dickinson e42f1bb354 Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__. 2010-07-08 19:09:16 +00:00
Mark Dickinson a123631a5c Fix a performance issue in Decimal.pow. Thanks Stefan Krah for finding this. 2010-07-08 19:03:34 +00:00
Antoine Pitrou f48ea7c2a9 Issue #8605: Skip test_gdb if Python is compiled with optimizations. 2010-07-08 18:51:30 +00:00
Mark Dickinson 247900ce47 In test_decimal, convert heuristic for skipping tests into an explicit skiplist. 2010-07-08 17:23:40 +00:00
Benjamin Peterson 6ef08a0ebe ValueError in this case is also acceptable 2010-07-07 22:45:06 +00:00
Benjamin Peterson de73c4587f don't ignore exceptions from PyObject_IsTrue 2010-07-07 18:54:59 +00:00
Benjamin Peterson c937dc2ccb this needn't be in the loop 2010-07-07 18:44:05 +00:00
Mark Dickinson be64d95169 Issue #9186: log1p(-1.0) should raise ValueError, not OverflowError. 2010-07-07 16:21:29 +00:00
Alexander Belopolsky a11d8c03a4 Issue #9000: datetime.timezone objects now have eval-friendly repr. 2010-07-06 23:19:45 +00:00
Brett Cannon c84dc9d018 Fix test_xmlrpc_net to no longer fail since there are no more buildbots for trunk. 2010-07-05 22:11:16 +00:00
Alexander Belopolsky d87e932f51 Added two more test cases for datetime 2010-07-05 17:57:31 +00:00
Benjamin Peterson 97c694b90b looking up on the type is correct, so this isn't an XXX 2010-07-05 17:11:05 +00:00
Alexander Belopolsky f34e82ef49 Added more tests for utctimetuple() 2010-07-05 15:05:33 +00:00
Benjamin Peterson 335d2c757d pydoc still has a silly encoding 2010-07-05 14:59:40 +00:00
Mark Dickinson 45a26b9b18 Revert -r82559; it's not clear that this is the right thing to do, and the change obscures the original intentions. 2010-07-04 20:07:09 +00:00
Mark Dickinson 30b570bb4b Re-encode shlex.py in UTF-8, and remove coding cookie. 2010-07-04 19:27:12 +00:00
Mark Dickinson b4a17a8440 Remove coding cookie from heapq.py. 2010-07-04 19:23:49 +00:00
Mark Dickinson feb3b75818 Issue #9130: Validate ellipsis tokens in relative imports. 2010-07-04 18:38:57 +00:00
Mark Dickinson 3445b482b3 Fix symbol numbers in test_parser test. 2010-07-04 18:15:26 +00:00
Mark Dickinson 2cc8a5e490 Issue #9130: Fix validation of relative imports in parser module. 2010-07-04 18:11:51 +00:00
Alexander Belopolsky 2e733c9625 Issue #9118: help(None) will now return NoneType doc instead of
starting interactive help.
2010-07-04 17:00:20 +00:00
Benjamin Peterson 766f5d9d73 Merged revisions 81478,82530-82531 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r81478 | benjamin.peterson | 2010-05-22 13:47:39 -0500 (Sat, 22 May 2010) | 1 line

  ensure doctests have some future_features
........
  r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line

  simplify ignore star imports from itertools #8892
........
  r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line

  wrap with parenthesis not \
........
2010-07-04 16:44:15 +00:00
Mark Dickinson 2bd61a988f Issue #9128: Fix validation of class decorators in parser module. 2010-07-04 16:37:31 +00:00
Brett Cannon 418182e18b Make importlib.abc.SourceLoader the primary mechanism for importlib.
This required moving the class from importlib/abc.py into
importlib/_bootstrap.py and jiggering some code to work better with the class.
This included changing how the file finder worked to better meet import
semantics. This also led to fixing importlib to handle the empty string from
sys.path as import currently does (and making me wish we didn't support that
instead just required people to insert '.' instead to represent cwd).

It also required making the new set_data abstractmethod create
any needed subdirectories implicitly thanks to __pycache__ (it was either this
or grow the SourceLoader ABC to gain an 'exists' method and either a mkdir
method or have set_data with no data arg mean to create a directory).

Lastly, as an optimization the file loaders cache the file path where the
finder found something to use for loading (this is thanks to having a
sourceless loader separate from the source loader to simplify the code and
cut out stat calls).
Unfortunately test_runpy assumed a loader would always work for a module, even
if you changed from underneath it what it was expected to work with. By simply
dropping the previous loader in test_runpy so the proper loader can be returned
by the finder fixed the failure.

At this point importlib deviates from import on two points:

1. The exception raised when trying to import a file is different (import does
an explicit file check to print a special message, importlib just says the path
cannot be imported as if it was just some module name).

2. the co_filename on a code object is not being set to where bytecode was
actually loaded from instead of where the marshalled code object originally
came from (a solution for this has already been agreed upon on python-dev but has
not been implemented yet; issue8611).
2010-07-03 22:32:41 +00:00
Brett Cannon d71bed3d76 Make importlib.abc.SourceLoader the primary mechanism for importlib.
This required moving the class from importlib/abc.py into
importlib/_bootstrap.py and jiggering some code to work better with the class.
This included changing how the file finder worked to better meet import
semantics. This also led to fixing importlib to handle the empty string from
sys.path as import currently does (and making me wish we didn't support that
instead just required people to insert '.' instead to represent cwd).

It also required making the new set_data abstractmethod create
any needed subdirectories implicitly thanks to __pycache__ (it was either this
or grow the SourceLoader ABC to gain an 'exists' method and either a mkdir
method or have set_data with no data arg mean to create a directory).

Lastly, as an optimization the file loaders cache the file path where the
finder found something to use for loading (this is thanks to having a
sourceless loader separate from the source loader to simplify the code and
cut out stat calls).
Unfortunately test_runpy assumed a loader would always work for a module, even
if you changed from underneath it what it was expected to work with. By simply
dropping the previous loader in test_runpy so the proper loader can be returned
by the finder fixed the failure.

At this point importlib deviates from import on two points:

1. The exception raised when trying to import a file is different (import does
an explicit file check to print a special message, importlib just says the path
cannot be imported as if it was just some module name).

2. the co_filename on a code object is not being set to where bytecode was
actually loaded from instead of where the marshalled code object originally
came from (a solution for this has already been agreed upon on python-dev but has
not been implemented yet; issue8611).
2010-07-03 22:18:47 +00:00
Brett Cannon 2cf1585499 Fix a spelling mistake in a comment. 2010-07-03 22:03:16 +00:00
Brett Cannon 61b14251d3 Make importlib.abc.SourceLoader the primary mechanism for importlib.
This required moving the class from importlib/abc.py into
importlib/_bootstrap.py and jiggering some code to work better with the class.
This included changing how the file finder worked to better meet import
semantics. This also led to fixing importlib to handle the empty string from
sys.path as import currently does (and making me wish we didn't support that
instead just required people to insert '.' instead to represent cwd).

It also required making the new set_data abstractmethod create
any needed subdirectories implicitly thanks to __pycache__ (it was either this
or grow the SourceLoader ABC to gain an 'exists' method and either a mkdir
method or have set_data with no data arg mean to create a directory).

Lastly, as an optimization the file loaders cache the file path where the
finder found something to use for loading (this is thanks to having a
sourceless loader separate from the source loader to simplify the code and
cut out stat calls).
Unfortunately test_runpy assumed a loader would always work for a module, even
if you changed from underneath it what it was expected to work with. By simply
dropping the previous loader in test_runpy so the proper loader can be returned
by the finder fixed the failure.

At this point importlib deviates from import on two points:

1. The exception raised when trying to import a file is different (import does
an explicit file check to print a special message, importlib just says the path
cannot be imported as if it was just some module name).

2. the co_filename on a code object is not being set to where bytecode was
actually loaded from instead of where the marshalled code object originally
came from (a solution for this has already been agreed upon on python-dev but has
not been implemented yet; issue8611).
2010-07-03 21:48:25 +00:00
Alexander Belopolsky 60c762b77a Issue #9094: Make python -m pickletools disassemble pickles given in
the command line.
2010-07-03 20:35:53 +00:00
Senthil Kumaran df022da3d8 Fix Issue5468 - urlencode to handle bytes and other alternate encodings.
(Extensive tests provided). Patch by Dan Mahn.
2010-07-03 17:48:22 +00:00
Victor Stinner bc5c54bca2 Merged revisions 82492 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82492 | victor.stinner | 2010-07-03 15:36:19 +0200 (sam., 03 juil. 2010) | 3 lines

  Issue #7673: Fix security vulnerability (CVE-2010-2089) in the audioop module,
  ensure that the input string length is a multiple of the frame size
........
2010-07-03 13:44:22 +00:00
Nick Coghlan 5c8b54eb04 Issue 6507: accept source strings directly in dis.dis(). Original patch by Daniel Urban 2010-07-03 07:36:51 +00:00
Brett Cannon 2cab50b937 Make test_import a little bit more robust for cleaning up after itself in the
face of a failure.
2010-07-03 01:32:48 +00:00
Benjamin Peterson e401c6842a Merged revisions 82461 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82461 | benjamin.peterson | 2010-07-02 18:05:27 -0500 (Fri, 02 Jul 2010) | 1 line

  don't require the presence of __getformat__ or __setformat__; use requires_IEEE_754 globally
........
2010-07-02 23:25:44 +00:00
Benjamin Peterson f751bc9c01 fix lookup of __ceil__ 2010-07-02 13:46:42 +00:00
Benjamin Peterson 8bb9cde6c0 correctly lookup __trunc__ and __floor__ 2010-07-01 15:16:55 +00:00
Ezio Melotti 57221d02ba Update PyUnicode_DecodeUTF8 from RFC 2279 to RFC 3629.
1) #8271: when a byte sequence is invalid, only the start byte and all the
   valid continuation bytes are now replaced by U+FFFD, instead of replacing
   the number of bytes specified by the start byte.
   See http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf (pages 94-95);
2) 5- and 6-bytes-long UTF-8 sequences are now considered invalid (no changes
   in behavior);
3) Change the error messages "unexpected code byte" to "invalid start byte"
   and "invalid data" to "invalid continuation byte";
4) Add an extensive set of tests in test_unicode;
5) Fix test_codeccallbacks because it was failing after this change.
2010-07-01 07:32:02 +00:00
Giampaolo Rodolà 610aa4f07f Merged revisions 82404 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82404 | giampaolo.rodola | 2010-06-30 19:38:28 +0200 (mer, 30 giu 2010) | 1 line

  fix issue #6589: cleanup asyncore.socket_map if smtpd.SMTPServer constructor raises an exception
........
2010-06-30 17:47:39 +00:00
Benjamin Peterson 1cc6df97bc Merged revisions 82403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82403 | benjamin.peterson | 2010-06-30 12:11:08 -0500 (Wed, 30 Jun 2010) | 1 line

  mark test depending on ref counting
........
2010-06-30 17:39:45 +00:00
Michael Foord b3a8984488 Issue 9110. Adding ContextDecorator to contextlib. This enables the creation of APIs that act as decorators as well as context managers. contextlib.contextmanager changed to use ContextDecorator. 2010-06-30 12:17:50 +00:00
Mark Dickinson 50b79a80bd Issue #9011: Tests for Python 3.2's treatment of negated imaginary literals. 2010-06-30 11:13:36 +00:00
Mark Dickinson 3c0b317e36 Merged revisions 82356 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82356 | mark.dickinson | 2010-06-29 08:37:25 +0100 (Tue, 29 Jun 2010) | 1 line

  Spelling.
........
2010-06-29 07:38:37 +00:00
Benjamin Peterson 902d2bd64d Merged revisions 82332 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82332 | benjamin.peterson | 2010-06-28 10:41:06 -0500 (Mon, 28 Jun 2010) | 1 line

  fix skipping condition
........
2010-06-28 15:43:25 +00:00
Benjamin Peterson 17e0bbc30c Merged revisions 82330 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82330 | benjamin.peterson | 2010-06-28 10:36:40 -0500 (Mon, 28 Jun 2010) | 1 line

  testcapi tests are definitely cpython only
........
2010-06-28 15:39:55 +00:00
Senthil Kumaran 8749a63473 Merged revisions 82324 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82324 | senthil.kumaran | 2010-06-28 19:26:46 +0530 (Mon, 28 Jun 2010) | 3 lines

  Fix Issue8653 - Docstring for urlunsplit function.
........
2010-06-28 14:08:00 +00:00