Commit Graph

79301 Commits

Author SHA1 Message Date
Benjamin Peterson e2135c6158 move definition to top of block 2013-05-16 19:38:22 -05:00
Victor Stinner 725e421222 Fix compilater warnings on Windows 64-bit 2013-05-17 00:19:59 +02:00
Senthil Kumaran 5ccf2ff3e9 merge from 3.3
Fix #17967 - Fix related to regression on Windows.

os.path.join(*self.dirs) produces an invalid path on windows.
ftp paths are always forward-slash seperated like this. /pub/dir.
2013-06-02 12:00:45 -07:00
Raymond Hettinger 697fd46d15 merge 2013-06-02 10:04:59 -07:00
Senthil Kumaran 88249b80d7 merge from 3.3
Fix thishost helper funtion in urllib. Returns the ipaddress of localhost when
hostname is resolvable by socket.gethostname for local machine. This all fixes
certain freebsd builtbot failures.
2013-06-01 11:12:52 -07:00
Andrew Kuchling edf33c0145 #18066: remove vestigial code depending on the sgi module 2013-06-01 13:52:30 -04:00
Senthil Kumaran e9ec2e173d merge from 3.3
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.
2013-06-01 08:27:53 -07:00
Benjamin Peterson 5cfbd2642c frozen modules now apparently have empty __path__ 2013-05-31 22:18:26 -07:00
Brett Cannon 3e0651b5fa Issue #18065: For frozen packages set __path__ to [].
Previously __path__ was set to [__name__], but that could lead to bad
results if someone managed to circumvent the frozen importer and
somehow ended up with a finder that thought __name__ was a legit
directory/location.
2013-05-31 23:18:39 -04:00
Brett Cannon 0e75c06886 fix whitespace 2013-05-31 18:57:45 -04:00
Brett Cannon 0dbb4c7f13 Issues #18088, 18089: Introduce
importlib.abc.Loader.init_module_attrs() and implement
importlib.abc.InspectLoader.load_module().

The importlib.abc.Loader.init_module_attrs() method sets the various
attributes on the module being loaded. It is done unconditionally to
support reloading. Typically people used
importlib.util.module_for_loader, but since that's a decorator there
was no way to override it's actions, so init_module_attrs() came into
existence to allow for overriding. This is also why module_for_loader
is now pending deprecation (having its other use replaced by
importlib.util.module_to_load).

All of this allowed for importlib.abc.InspectLoader.load_module() to
be implemented. At this point you can now implement a loader with
nothing more than get_code() (which only requires get_source();
package support requires is_package()). Thanks to init_module_attrs()
the implementation of load_module() is basically a context manager
containing 2 methods calls, a call to exec(), and a return statement.
2013-05-31 18:56:47 -04:00
Brett Cannon f1d7b11db9 Docstring cleanup 2013-05-31 18:39:07 -04:00
Brett Cannon c29cb41822 Fix for last commit on adding reset_name to module_to_load 2013-05-31 18:37:44 -04:00
Brett Cannon b60a43eabf Add a reset_name argument to importlib.util.module_to_load in order to
control whether to reset the module's __name__ attribute in case a
reload is being done.
2013-05-31 18:11:17 -04:00
Brett Cannon 028d51236a Update What's New for importlib.util.module_to_load name change 2013-05-31 18:02:11 -04:00
Brett Cannon 177381116e Add a reference to module_to_load 2013-05-31 18:00:56 -04:00
Serhiy Storchaka c7a2825681 Issue #18094: test_uuid no more reports skipped tests as passed. 2013-05-31 22:34:00 +03:00
Terry Jan Reedy 1acd3a081c Remove duplicate entry due to mismerge and incomplete resolution. 2013-05-30 21:08:49 -04:00
Terry Jan Reedy 17bea376e8 merge 2013-05-30 21:05:53 -04:00
Brett Cannon 357c9fb055 Rename importlib.util.ModuleManager to module_to_load so that the name
explains better what the context manager is providing.
2013-05-30 17:31:47 -04:00
Łukasz Langa 335ab5b66f Fixed #18075 - Infinite recursion tests triggering a segfault on Mac OS X
Patch by Ronald Oussoren
2013-05-30 20:58:53 +02:00
Serhiy Storchaka ad0e6b1034 Merge heads 2013-05-29 23:45:05 +03:00
Serhiy Storchaka d739bda6b2 Issue #18084: Use sys.byteorder in wave.py.
Original patch by Hideaki Takahashi.
2013-05-29 23:38:00 +03:00
Stefan Krah b6cc0aad4b Merge 3.3. 2013-05-29 21:12:46 +02:00
Stefan Krah f7b62a366e Null merge. 2013-05-29 19:15:28 +02:00
Stefan Krah a0547b8ac4 Mark untestable lines for gcov. 2013-05-29 19:08:34 +02:00
Stefan Krah 2e537f9edc test_decimal: add __sizeof__() tests for code coverage. 2013-05-29 18:50:06 +02:00
Serhiy Storchaka 1cfebc73e0 Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and
PyObject_CallMethod() now changed to `const char*`.
Based on patches by Jörg Müller and Lars Buitinck.
2013-05-29 18:50:54 +03:00
Stefan Krah 8d90e383a3 Merge 3.3. 2013-05-29 15:47:24 +02:00
Senthil Kumaran 6b3026ce72 merge from 3.3
#17403: urllib.parse.robotparser normalizes the urls before adding to
ruleline. This helps in handling certain types invalid urls in a conservative
manner. Patch contributed by Mher Movsisyan.
2013-05-29 05:57:21 -07:00
Terry Jan Reedy 7b503965a0 Merge with 3.3 2013-05-28 22:22:14 -04:00
Andrew Kuchling 1e170bae71 #1554133: Document PyOS_InputHook, PyOS_ReadlineFunctionPointer 2013-05-28 21:48:28 -04:00
Ned Deily 6750282007 Issue #18080: merge from 3.3 2013-05-28 16:45:06 -07:00
Brett Cannon 56dfc2127f Undo a recommendation as load_module() methods might be called directly 2013-05-28 18:40:31 -04:00
Brett Cannon 3dc48d6f69 Issue #18070: importlib.util.module_for_loader() now sets __loader__
and __package__ unconditionally in order to do the right thing for
reloading.
2013-05-28 18:35:54 -04:00
Brett Cannon a22faca714 Clarify some documentation 2013-05-28 17:50:14 -04:00
Brett Cannon f5fe13099e Update importlib.h 2013-05-28 17:50:04 -04:00
Brett Cannon a3687f0d68 Introduce importlib.util.ModuleManager which is a context manager to
handle providing (and cleaning up if needed) the module to be loaded.

A future commit will use the context manager in
Lib/importlib/_bootstrap.py and thus why the code is placed there
instead of in Lib/importlib/util.py.
2013-05-28 17:29:34 -04:00
Serhiy Storchaka 4dbae88131 Issue #18085: Fix PyObject_CallMethodObjArgs()'s entry in refcounts.dat. 2013-05-28 22:47:36 +03:00
Serhiy Storchaka 281945f427 Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw
stream's read() returns more bytes than requested.
2013-05-28 16:27:08 +03:00
Serhiy Storchaka 5758fa78d0 Issue #17746: Skip test_shutil.test_non_matching_mode when run as root or
on unsuitable platform/environment.
2013-05-28 15:53:46 +03:00
Serhiy Storchaka 5cc9d32ee9 Issue #18011: Silence an unrelated noise introduced in changeset 1b5ef05d6ced. 2013-05-28 15:42:34 +03:00
Serhiy Storchaka 80f3bf95f1 Move some Misc/NEWS entries to correct place. 2013-05-28 15:34:16 +03:00
Serhiy Storchaka 77a3ad743f Issue #18011: base64.b32decode() now raises a binascii.Error if there are
non-alphabet characters present in the input string to conform a docstring.
Updated the module documentation.
2013-05-28 15:30:38 +03:00
Serhiy Storchaka 3801f632dc Issue #18079: Fix a typo in the tutorial. 2013-05-28 12:50:54 +03:00
Jason R. Coombs fb1141cd55 Merge with 3.3 2013-05-27 23:53:02 -04:00
Jason R. Coombs 8f1a8e32b1 Merge with 3.3 2013-05-27 23:26:36 -04:00
Terry Jan Reedy 667a03b292 Merge with 3.3 2013-05-27 21:33:40 -04:00
Brett Cannon fc508dd608 NEWS entry for issue #18072 2013-05-27 21:12:40 -04:00
Brett Cannon 3b62ca88e4 Issue #18072: Implement get_code() for importlib.abc.InspectLoader and
ExecutionLoader.
2013-05-27 21:11:04 -04:00