Nick Coghlan
ceda83c6a9
Make set_main_loader static (noticed by Antoine Pitrou)
2012-07-15 23:18:08 +10:00
Nick Coghlan
2824cb507d
Issue #15343 : A lot more than just unicode decoding can go wrong when retrieving a source file
2012-07-15 22:12:14 +10:00
Nick Coghlan
3f94cbf9eb
Actually initialize __main__.__loader__ with loader instances, not the corresponding type objects
2012-07-15 19:10:39 +10:00
Nick Coghlan
85e729ec3b
Take the first step in resolving the messy pkgutil vs importlib edge cases by basing pkgutil explicitly on importlib, deprecating its internal import emulation and setting __main__.__loader__ correctly so that runpy still works (Affects #15343 , #15314 , #15357 )
2012-07-15 18:09:52 +10:00
Brett Cannon
a6473f9cfd
Issues #15169 , #14599 : Make PyImport_ExecCodeModuleWithPathnames() use
...
Lib/imp.py for imp.source_from_cache() instead of its own C version.
Also change PyImport_ExecCodeModuleObject() to not infer the source
path from the bytecode path like
PyImport_ExecCodeModuleWithPathnames() does. This makes the function
less magical.
This also has the side-effect of removing all uses of MAXPATHLEN in
Python/import.c which can cause failures on really long filenames.
2012-07-13 13:57:03 -04:00
Antoine Pitrou
44b4b6a9a5
Fix compilation under Windows
2012-07-10 18:27:54 +02:00
Brett Cannon
461c813164
Issue #15111 : When a module was imported using a 'from import'
...
statement (e.g. ``from distutils import msvc9compiler``) that triggers
an ImportError of its own (e.g. the non-existence of winreg), let that
exception propagate instead of raising a generic ImportError for the
module being requested (e.g. msvc9compiler).
2012-07-10 10:05:00 -04:00
Benjamin Peterson
66f3659c9e
fix refleak
2012-07-09 22:21:55 -07:00
Benjamin Peterson
fa873704a4
initialize variable for compiler happiness
2012-07-09 13:43:53 -07:00
Brett Cannon
77b2abd094
Issue #15167 (as part of #13959 ): imp.get_magic() is no implemented in
...
Lib/imp.py.
2012-07-09 16:09:00 -04:00
Brett Cannon
3adc7b75a5
Issue #15242 : Have PyImport_GetMagicTag() return a const char *
...
defined in sysmodule.c instead of straight out of a Unicode object.
Thanks to Amaury Forgeot d'Arc for noticing the bug and Eric Snow for
writing the patch.
2012-07-09 14:22:12 -04:00
Brett Cannon
19a2f5961c
Issue #15056 : imp.cache_from_source() and source_from_cache() raise
...
NotimplementedError when sys.implementation.cache_tag is None.
Thanks to Pranav Ravichandran for taking an initial stab at the patch.
2012-07-09 13:58:07 -04:00
Amaury Forgeot d'Arc
ae7b8f07c1
Issue #15110 : Also hide importlib frames when importing a builtin module fails.
2012-07-08 20:52:38 +02:00
Benjamin Peterson
8107176f9b
add gc support to the AST base type ( closes #15293 )
2012-07-08 11:03:46 -07:00
Antoine Pitrou
507507473e
Issue #15291 : Fix a memory leak where AST nodes where not properly deallocated.
2012-07-08 12:43:32 +02:00
Antoine Pitrou
bc07a5c913
Issue #15110 : Fix the tracebacks generated by "import xxx" to not show the importlib stack frames.
2012-07-08 12:01:27 +02:00
Antoine Pitrou
bc1a7ddc9b
Check-in compiled importlib changes (you must run "make" after modifying the importlib sources).
2012-07-07 19:49:44 +02:00
Antoine Pitrou
74de153681
Issue #15020 : The program name used to search for Python's path is now python3 under Unix, not python.
2012-07-05 20:57:33 +02:00
Antoine Pitrou
01cca5e451
Issue #15020 : The program name used to search for Python's path is now "python3" under Unix, not "python".
2012-07-05 20:56:30 +02:00
Brett Cannon
98979b85e7
Issue #15166 : Re-implement imp.get_tag() using sys.implementation.
...
Also eliminates some C code in Python/import.c as well.
Patch by Eric Snow with verification by comparing against another
patch from Jeff Knupp.
2012-07-02 15:13:11 -04:00
Brett Cannon
8a250fac15
Comment out a dead increment.
...
Found by Clang's static analyzer.
2012-06-25 16:13:44 -04:00
Antoine Pitrou
0ab5cf9b46
Issue #15181 : importlib bytecode is unsigned and shouldn't have negative numbers.
...
This fixes a compiler warning with suncc.
2012-06-25 17:32:43 +02:00
Eric V. Smith
e51a36922f
Fixes issue 15039: namespace packages are no longer imported in preference to modules of the same name.
2012-06-24 19:13:55 -04:00
Antoine Pitrou
edc601855d
Remove outdated statement
2012-06-23 14:19:58 +02:00
Antoine Pitrou
310f95b04d
A better repr() for FileFinder
2012-06-23 02:12:56 +02:00
David Malcolm
49526f48fc
Issue #14785 : Add sys._debugmallocstats() to help debug low-level memory allocation issues
2012-06-22 14:55:41 -04:00
Martin v. Löwis
7800f75827
Issue #15042 : Add PyState_AddModule and PyState_RemoveModule.
...
Add version guard for Py_LIMITED_API additions.
Issue #15081 : Document PyState_FindModule.
Patch by Robin Schreiber.
2012-06-22 12:20:55 +02:00
doko@ubuntu.com
39378f7f4f
format_obj: make it static
2012-06-21 12:12:20 +02:00
Antoine Pitrou
e67f48ce5e
Issue #14928 : Fix importlib bootstrap issues by using a custom executable (Modules/_freeze_importlib) to build Python/importlib.h.
2012-06-19 22:29:35 +02:00
Kristjan Valur Jonsson
0006aacb9d
Issue #15038 : Document caveats with the emulated condition variables.
2012-06-19 16:30:28 +00:00
Antoine Pitrou
1d25b6f04a
Issue #15103 : remove the NUL character (serving as a Mercurial binary marker) from Python/importlib.h.
...
Instead the email notification hook uses a configuration option to omit importlib.h diffs.
2012-06-19 16:33:39 +02:00
Kristjan Valur Jonsson
1617077bcc
Issue #15038 :
...
Fix incorrect test of the condition variable state, spotted by
Richard Oudkerk. This could cause the internal condition variable
to grow without bounds.
2012-06-19 10:10:09 +00:00
Kristján Valur Jónsson
e75ff35af2
Issue #15038 : Optimize python Locks on Windows
...
Extract cross-platform condition variable support into a separate file and
provide user-mode non-recursive locks for Windows.
2012-06-18 20:30:44 +00:00
Nick Coghlan
c40bc09942
Issue #13783 : the PEP 380 implementation no longer expands the public C API
2012-06-17 15:15:49 +10:00
Antoine Pitrou
2d9db1dfce
Try to fix issue #15086 : build failure on Ubuntu shared buildbot.
2012-06-17 00:27:30 +02:00
Victor Stinner
81c39a88a4
get_sourcefile(): use PyUnicode_READ() to avoid the creation of a temporary
...
Py_UCS4 buffer
2012-06-16 03:22:05 +02:00
Victor Stinner
c9d369f1bf
Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)
2012-06-16 02:22:37 +02:00
Brett Cannon
24aa693c7e
Merge
2012-06-15 19:04:29 -04:00
Victor Stinner
2b89fdf7eb
PEP 418: Rename adjusted attribute to adjustable in time.get_clock_info() result
...
Fix also its value on Windows and Linux according to its documentation:
"adjustable" indicates if the clock *can be* adjusted, not if it is or was
adjusted.
In most cases, it is not possible to indicate if a clock is or was adjusted.
2012-06-12 22:46:37 +02:00
Brett Cannon
99d776fdf4
Update importlib.h by touching Lib/importlib/_bootstrap.py.
2012-06-11 11:02:53 -04:00
Kristján Valur Jónsson
187aa54516
Signal condition variables with the mutex held. Destroy condition variables
...
before their mutexes.
2012-06-05 22:17:42 +00:00
Barry Warsaw
409da157d7
Eric Snow's implementation of PEP 421.
...
Issue 14673: Add sys.implementation
2012-06-03 16:18:47 -04:00
Benjamin Peterson
3a37b8393c
merge 3.2
2012-06-01 23:57:50 -07:00
Benjamin Peterson
8e8fbeae27
don't leak if the __class__ closure is set
2012-06-01 23:57:36 -07:00
Benjamin Peterson
d1ab6089ff
check return for error
2012-06-01 11:18:22 -07:00
Victor Stinner
d3f0882dfb
Issue #14744 : Use the new _PyUnicodeWriter internal API to speed up str%args and str.format(args)
...
* Formatting string, int, float and complex use the _PyUnicodeWriter API. It
avoids a temporary buffer in most cases.
* Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just
keep a reference to the string if the output is only composed of one string
* Disable overallocation when formatting the last argument of str%args and
str.format(args)
* Overallocation allocates at least 100 characters: add min_length attribute
to the _PyUnicodeWriter structure
* Add new private functions: _PyUnicode_FastCopyCharacters(),
_PyUnicode_FastFill() and _PyUnicode_FromASCII()
The speed up is around 20% in average.
2012-05-29 12:57:52 +02:00
Victor Stinner
a1b0c9fc4d
PyArg_Parse*("U"): ensure that the Unicode string is ready
2012-05-29 12:30:29 +02:00
Nick Coghlan
0b43bcf528
Close #14857 : fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370 , but also updates unittest.mock to workaround that issue
2012-05-27 18:17:07 +10:00
Nick Coghlan
5c6eba3a93
Tweak importlib._bootstrap to avoid zero-argument super so I can work on issue #14857 without breaking imports
2012-05-27 17:49:58 +10:00
Brett Cannon
d785cb3955
Remove some redundant decorators.
2012-05-26 14:28:21 -04:00
Vinay Sajip
7ded1f0f69
Implemented PEP 405 (Python virtual environments).
2012-05-26 03:45:29 +01:00
Eric V. Smith
984b11f88f
issue 14660: Implement PEP 420, namespace packages.
2012-05-24 20:21:04 -04:00
Antoine Pitrou
ea3eb88bca
Issue #9260 : A finer-grained import lock.
...
Most of the import sequence now uses per-module locks rather than the
global import lock, eliminating well-known issues with threads and imports.
2012-05-17 18:55:59 +02:00
Antoine Pitrou
b84bc7a7ce
Avoid "warning: no newline at end of file" in importlib.h.
2012-05-16 12:58:04 +02:00
Benjamin Peterson
77fa9379e2
use Py_ssize_t for ast sequence lengths
2012-05-15 10:10:27 -07:00
Martin v. Löwis
41829e82c1
Document f4d7ad6c9d6e.
2012-05-15 14:52:36 +02:00
Martin v. Löwis
cc10a37ef0
Widen ASDL sequences to Py_ssize_t lengths to better match PEP 353.
2012-05-15 14:45:03 +02:00
Benjamin Peterson
6ecf8ce364
apparently importlib.h wants to be updated
2012-05-14 22:17:34 -07:00
Benjamin Peterson
d5a1c44455
PEP 415: Implement suppression of __context__ display with an exception attribute
...
This replaces the original PEP 409 implementation. See #14133 .
2012-05-14 22:09:31 -07:00
Brian Curtin
401f9f3d32
Fix #13210 . Port the Windows build from VS2008 to VS2010.
2012-05-13 11:19:23 -05:00
Brett Cannon
c049952de7
Issue #13959 : Have
...
importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.
This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
2012-05-11 14:48:41 -04:00
Brett Cannon
44ec91f6a5
Update importlib.h
2012-05-11 13:11:02 -04:00
Antoine Pitrou
d576c711a5
Issue #14761 : Fix potential leak on an error case in the import machinery.
2012-05-09 13:24:31 +02:00
Larry Hastings
a34790104c
Issue #14746 : Remove redundant paragraphs from skipitem() in Python/getargs.c.
2012-05-08 23:52:03 -07:00
Larry Hastings
d3f424fe45
Merge from 3.2. Issue #14749 : Add support for 'Z' to skipitem().
2012-05-08 03:54:05 -07:00
Larry Hastings
d9e4a414d7
Issue #14749 : Add support for 'Z' to skipitem() in Python/getargs.c.
2012-05-08 03:51:18 -07:00
Antoine Pitrou
6efa50a384
Issue #14583 : Fix importlib bug when a package's __init__.py would first import one of its modules then raise an error.
2012-05-07 21:41:59 +02:00
Larry Hastings
10ba07a39e
Issue #14705 : Added support for the new 'p' format unit to skipitem().
2012-05-07 02:44:50 -07:00
Antoine Pitrou
b78174c010
Fix too early decrefs.
2012-05-06 17:15:23 +02:00
Larry Hastings
faf91e75ab
Issue #14705 : Add 'p' format character to PyArg_ParseTuple* for bool support.
2012-05-05 16:54:29 -07:00
Nadeem Vawda
8f46d655b9
Fix typo in changeset eb5c5c23ca9b.
2012-05-05 12:27:30 +02:00
Brett Cannon
feccc09952
Clean up a docstring.
2012-05-04 16:47:54 -04:00
Antoine Pitrou
f3a42dee9a
Simplify code for load_dynamic()
2012-05-04 22:40:25 +02:00
Brett Cannon
0429e1a57d
Issue #13959 : Move module type constants to Lib/imp.py.
2012-05-04 16:13:30 -04:00
Brett Cannon
6b9b727695
Remove dead Windows code which no longer will compile.
2012-05-04 16:04:14 -04:00
Brett Cannon
a6685e8d36
update importlib.h
2012-05-04 16:03:20 -04:00
Brett Cannon
2657df4744
Issue #13959 : Re-implement imp.get_suffixes() in Lib/imp.py.
...
This introduces a new function, imp.extension_suffixes(), which is
currently undocumented. That is forthcoming once issue #14657 is
resolved and how to expose file suffixes is decided.
2012-05-04 15:20:40 -04:00
Larry Hastings
76ad59b7e8
Issue #14127 : Add ns= parameter to utime, futimes, and lutimes.
...
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Benjamin Peterson
49a69e4d48
strip is_ prefixes on clock_info fields
2012-05-01 09:38:34 -04:00
Brett Cannon
62228dbd6c
Issues #13959 , 14647: Re-implement imp.reload() in Lib/imp.py.
...
Thanks to Eric Snow for the patch.
2012-04-29 14:38:11 -04:00
Brett Cannon
acf85cd131
Issue #13959 : Re-implement imp.NullImporter in Lib/imp.py.
2012-04-29 12:50:03 -04:00
Mark Dickinson
e383e82e04
Issue #14521 : Make result of float('nan') and float('-nan') more consistent across platforms. Further, don't rely on Py_HUGE_VAL for float('inf').
2012-04-29 15:31:56 +01:00
Victor Stinner
ec89539ccc
Issue #14428 , #14397 : Implement the PEP 418
...
* Rename time.steady() to time.monotonic()
* On Windows, time.monotonic() uses GetTickCount/GetTickCount64() instead of
QueryPerformanceCounter()
* time.monotonic() uses CLOCK_HIGHRES if available
* Add time.get_clock_info(), time.perf_counter() and time.process_time()
functions
2012-04-29 02:41:27 +02:00
Brett Cannon
efad00d520
Issue #14646 : __import__() now sets __loader__ if need be.
...
importlib.util.module_for_loader also will set __loader__ along with
__package__. This is in conjunction to a forthcoming update to PEP 302
which will make these two attributes required for loaders to set.
2012-04-27 17:27:14 -04:00
Brett Cannon
fea73efc9e
Issue #14605 : Don't error out if get_importer() returns None.
2012-04-27 15:45:15 -04:00
Brett Cannon
aa93642a35
Issue #14605 : Use None in sys.path_importer_cache to represent no
...
finder instead of using some (now non-existent) implicit finder.
2012-04-27 15:30:58 -04:00
Brett Cannon
ce418b448f
Issue #14605 : Stop having implicit entries for sys.meta_path.
...
ImportWarning is raised if sys.meta_path is found to be empty.
2012-04-27 14:01:58 -04:00
Victor Stinner
8f825060f1
Check newly created consistency using _PyUnicode_CheckConsistency(str, 1)
...
* In debug mode, fill the string data with invalid characters
* Simplify also reference counting in PyCodec_BackslashReplaceErrors()
and PyCodec_XMLCharRefReplaceError()
2012-04-27 13:55:39 +02:00
Benjamin Peterson
9fa47ebafe
merge heads
2012-04-26 00:27:06 -04:00
Benjamin Peterson
1138944888
only incref when using borrowing functions
2012-04-26 00:26:37 -04:00
Brett Cannon
e0d88a173c
Issue #14605 : Make explicit the entries on sys.path_hooks that used to
...
be implicit.
Added a warning for when sys.path_hooks is found to be empty. Also
changed the meaning of None in sys.path_importer_cache to represent
trying sys.path_hooks again (an interpretation of previous semantics).
Also added a warning for when None was found.
The long-term goal is for None in sys.path_importer_cache to represent
the same as imp.NullImporter: no finder found for that sys.path entry.
2012-04-25 20:54:04 -04:00
Brett Cannon
f96bb2f9af
Update importlib.h
2012-04-25 20:18:55 -04:00
Brett Cannon
5a5d6a1033
Merge
2012-04-25 20:18:24 -04:00
Marc-Andre Lemburg
7541c8ea37
Issue #14605 and #14642 :
...
Issue a warning in case Python\importlib.h needs to be rebuilt,
but there's no Python interpreter around to freeze the bootstrap
script.
2012-04-25 10:54:48 +02:00
Brett Cannon
8923a4d4c5
Issue #14605 : Insert to the front of sys.path_hooks instead of appending.
2012-04-24 22:03:46 -04:00
Marc-Andre Lemburg
4fe29c9657
Issue #14605 : Rename _SourcelessFileLoader to SourcelessFileLoader.
...
This time also recreating the Python/importlib.h file to make
make happy. See the ticket for details.
2012-04-25 02:31:37 +02:00
Victor Stinner
ece58deb9f
Close #14648 : Compute correctly maxchar in str.format() for substrin
2012-04-23 23:36:38 +02:00
Benjamin Peterson
7d95e40721
Implement PEP 412: Key-sharing dictionaries ( closes #13903 )
...
Patch from Mark Shannon.
2012-04-23 11:24:50 -04:00
Benjamin Peterson
80d07f8251
inherit maxchar of field value where needed ( closes #14648 )
2012-04-23 10:55:29 -04:00
Brett Cannon
938d44d59c
Issue #14605 : Expose importlib.abc.FileLoader and
...
importlib.machinery.(FileFinder, SourceFileLoader,
_SourcelessFileLoader, ExtensionFileLoader).
This exposes all of importlib's mechanisms that will become public on
the sys module.
2012-04-22 19:58:33 -04:00