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
Brett Cannon
5c903e6ee1
Issue #13959 : Continue to try to accomodate altsep in importlib by not
...
ignoring altsep if it already exists on a path when doing a join.
2012-04-22 11:45:07 -04:00
Brett Cannon
cf649958f7
Revert to os.path.join() semantics for path manipulation in importlib
...
which is different than what imp.cache_from_source() operates on.
2012-04-22 02:06:23 -04:00
Brett Cannon
6c802b8491
Update importlib.h
2012-04-21 21:47:08 -04:00
Brett Cannon
0d05a7698b
Have importlib look for pre-existing path separators when joining
...
paths.
2012-04-21 21:21:27 -04:00
Brett Cannon
e69f0df45b
Issue #13959 : Re-implement imp.find_module() in Lib/imp.py.
...
Thanks to Eric Snow for taking an initial stab at the implementation.
2012-04-21 21:09:46 -04:00
Brett Cannon
2f92389d5c
Don't worry about moving imp.get_tag() over to Lib/imp.py.
2012-04-21 18:55:51 -04:00
Brett Cannon
a64faf0771
Issue #13959 : Re-implement imp.source_from_cache() in Lib/imp.py.
2012-04-21 18:52:52 -04:00
Brett Cannon
ea59dbff16
Issue #13959 : Re-implement imp.cache_from_source() in Lib/imp.py.
2012-04-20 21:44:46 -04:00
Brett Cannon
ed672d6872
Make path manipulation more robust for platforms with alternative path
...
separators.
2012-04-20 21:19:53 -04:00
Brett Cannon
24117a748b
Issue #13959 : Keep imp.get_magic() in C code, but cache in importlib
...
for performance. While get_magic() could move to Lib/imp.py, having to
support PyImport_GetMagicNumber() would lead to equal, if not more, C
code than sticking with the status quo.
2012-04-20 18:04:03 -04:00
Brett Cannon
3dfc22cc04
Issue #14599 : Support ImportError.path on AIX and HPUX when loading
...
extension modules.
2012-04-20 15:31:11 -04:00
Brett Cannon
f0434e647a
Issue #14599 : Generalize a test for ImportError.path and add support
...
in Python/dynload_shlibs.c.
This should fix the remaining importlib test failure on Windows.
Support in AIX and HP-UX will be in a separate checkin.
2012-04-20 15:22:50 -04:00
Brett Cannon
8ff6baf25b
Issue #14581 : Windows users are allowed to import modules w/o taking
...
the file suffix's case into account, even when doing a case-sensitive
import.
2012-04-20 12:53:14 -04:00
Larry Hastings
6fe20b3aee
Issue #14127 : Add st_{cma}time_ns fields to os.stat() result object.
2012-04-19 15:07:49 -07:00
Antoine Pitrou
bf35c156b4
Fix refleak: PyObject_GetItem returns a new reference, not a borrowed one like PyDict_GetItem.
2012-04-19 18:21:04 +02:00
Martin v. Löwis
aa2efcb0bc
Issue #14098 : New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
...
Patch by Stefan Behnel.
2012-04-19 14:33:43 +02:00
Victor Stinner
b0b224233e
Issue #14385 : Support other types than dict for __builtins__
...
It is now possible to use a custom type for the __builtins__ namespace, instead
of a dict. It can be used for sandboxing for example. Raise also a NameError
instead of ImportError if __build_class__ name if not found in __builtins__.
2012-04-19 00:57:45 +02:00
Benjamin Peterson
665c3b3eec
update importlib...
2012-04-18 15:29:52 -04:00
Antoine Pitrou
eca851815d
Merge heads
2012-04-18 16:59:52 +02:00
Antoine Pitrou
ec9bac4226
Fix it for good :-)
2012-04-18 16:57:54 +02:00
Benjamin Peterson
d76bc7abac
rollback 005fd1fe31ab (see #14609 and #14582 )
...
Being able to overload a sys.module entry during import of a module was broken
by this changeset.
2012-04-18 10:55:43 -04:00
Benjamin Peterson
da20cd2b6b
fix refcnt/style/debuging oversights
2012-04-18 10:48:00 -04:00
Brian Curtin
94c001b503
Fix email post-commit review comments.
...
Add INCREFs, fix args->kwargs, and a second args==NULL check was removed,
left over from a merger with another function. Instead, checking msg==NULL
does what that used to do in a roundabout way.
2012-04-18 08:30:51 -05:00
Brett Cannon
03c7ed1580
Merge
2012-04-17 21:42:07 -04:00
Brett Cannon
7bd329d800
Issue #12599 : Be more strict in accepting None vs. a false-like object
...
in importlib.
Thanks to PJE for pointing out the issue and Nick Coghlan for filing
the bug.
2012-04-17 21:41:35 -04:00
Benjamin Peterson
2a1fdc4c76
merge 3.2 ( #14607 )
2012-04-17 19:54:35 -04:00
Benjamin Peterson
32c59b6fc1
mangle keyword-only argname when loading defaults ( closes #14607 )
2012-04-17 19:53:21 -04:00
Brett Cannon
64befe939c
Issue #13959 : Re-implement imp.load_compiled() in imp.py.
2012-04-17 19:14:26 -04:00
Brett Cannon
273323cf68
Issue #14592 : A relative import will raise a KeyError if __package__
...
or __name__ are not set in globals.
Thanks to Stefan Behnel for the bug report.
2012-04-17 19:05:11 -04:00
Brian Curtin
09b86d1196
Fix #14600 . Correct reference handling and naming of ImportError convenience function
2012-04-17 16:57:09 -05:00
Brett Cannon
16475adcbb
Issue #13959 : Re-implement imp.load_source() in imp.py.
2012-04-16 22:11:25 -04:00
Antoine Pitrou
22a1d17bb5
Fix another refleak
2012-04-16 22:06:21 +02:00
Antoine Pitrou
538ba2afb5
Fix a refleak
2012-04-16 21:52:45 +02:00
Antoine Pitrou
71382cb64b
Fix reference loss on Py_None when None is encountered in sys.modules.
2012-04-16 18:48:49 +02:00
Antoine Pitrou
a938c74751
Avoid compiler warning due to stray \x00
2012-04-16 18:30:54 +02:00
Brian Curtin
b206a80dab
Fix #10854 . Make use of the new path and name attributes on ImportError
...
for extension modules on Windows.
2012-04-16 00:10:17 -05:00
Brett Cannon
2ee61422ed
Issue #13959 : Re-implement imp.load_package() in imp.py.
...
Thanks to Eric Snow for helping with imp.load_module() (previous
commit) which led to the removal of a bunch of C code.
2012-04-15 22:28:28 -04:00
Brett Cannon
01a76171a0
Issue #13959 : Re-implement imp.load_module() in imp.py.
2012-04-15 20:25:23 -04:00
Brett Cannon
c1b3f63653
Try to get hg to treat importlib.h as binary.
2012-04-15 19:05:31 -04:00
Brett Cannon
8a1d04c643
Issue #13959 : Simplify imp.reload() by relying on a module's
...
__loader__.
Since import now sets __loader__ on all modules it creates and
imp.reload() already relied on the attribute for modules that import
didn't create, the only potential compatibility issue is if people
were deleting the attribute on modules and expecting imp.reload() to
continue to work.
2012-04-15 17:56:09 -04:00
Brett Cannon
7ceedb8c1e
Update importlib.h
2012-04-15 17:47:19 -04:00
Brett Cannon
6f44d66bc4
Issue #13959 : Rename imp to _imp and add Lib/imp.py and begin
...
rewriting functionality in pure Python.
To start, imp.new_module() has been rewritten in pure Python, put into
importlib (privately) and then publicly exposed in imp.
2012-04-15 16:08:47 -04:00
Brett Cannon
881535b726
Issue #14582 : Import returns the module returned by a loader instead
...
of sys.modules when possible.
This is being done for two reasons. One is to gain a little bit of
performance by skipping an unnecessary dict lookup in sys.modules. But
the other (and main) reason is to be a little bit more clear in how
things should work from the perspective of import's interactions with
loaders. Otherwise loaders can easily forget to return the module even
though PEP 302 explicitly states they are expected to return the module
they loaded.
2012-04-15 15:24:04 -04:00
Brett Cannon
27fc52877c
Set ImportError.name when raising the exception in the case of None
...
found in sys.modules.
2012-04-15 14:15:31 -04:00
Brett Cannon
fc9ca274b8
Plug a refleak.
2012-04-15 01:35:05 -04:00
Brett Cannon
49f8d8b016
Handle importing pkg.mod by executing
...
__import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and
thus not segfaulting).
2012-04-14 21:50:00 -04:00
Brett Cannon
59f9c3affc
Rebuild importlib.h to incorporate added comments.
2012-04-14 21:18:48 -04:00
Brian Curtin
e6b299faf5
Fix Windows build
2012-04-14 14:19:33 -05:00
Brett Cannon
740fce0e38
Undo a C99 idiom.
2012-04-14 14:23:49 -04:00
Brett Cannon
fd0741555b
Issue #2377 : Make importlib the implementation of __import__().
...
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Benjamin Peterson
780b66b3e6
merge 3.2
2012-04-13 18:06:42 -04:00
Benjamin Peterson
3bf01757b6
move outside WITH_THREAD conditional
2012-04-13 18:06:36 -04:00
Benjamin Peterson
899ee613f7
merge 3.2
2012-04-13 11:59:52 -04:00
Benjamin Peterson
43162b8a02
take linkage def outside of WITH_THREAD conditional ( closes #14569 )
2012-04-13 11:58:27 -04:00
Brett Cannon
79ec55e980
Issue #1559549 : Add 'name' and 'path' attributes to ImportError.
...
Currently import does not use these attributes as they are planned
for use by importlib (which will be another commit).
Thanks to Filip Gruszczyński for the initial patch and Brian Curtin
for refining it.
2012-04-12 20:24:54 -04:00
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
2012-04-03 10:49:41 +00:00
Benjamin Peterson
0a9a636302
merge 3.2
2012-04-03 00:35:36 -04:00
Benjamin Peterson
80d50428ce
fix parse_syntax_error to clean up its resources
2012-04-03 00:30:38 -04:00
Brett Cannon
368b4b7405
Guard an LLTRACE variable to silence an unused variable warning.
2012-04-02 12:17:59 -04:00
Victor Stinner
3c1e48176e
Issue #14383 : Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
...
These functions simplify the usage of static constant Unicode strings.
Generalize the usage of _Py_Identifier in ceval.c and typeobject.c.
2012-03-26 22:10:51 +02:00
Kristján Valur Jónsson
4b0215fd99
Merge with 3.2
2012-03-23 12:52:11 +00:00
Kristján Valur Jónsson
c5d47d5ac3
Fix typo when "PyObject*" was changed to "identifier"
2012-03-23 12:50:53 +00:00
Benjamin Peterson
cc58031d6a
merge 3.2
2012-03-22 10:40:20 -04:00
Benjamin Peterson
9faf5ee750
this should technicaly be identifier
2012-03-22 10:39:16 -04:00
Benjamin Peterson
b304764ba2
merge 3.2
2012-03-22 08:56:27 -04:00
Benjamin Peterson
ab79c71f39
check for NULL
2012-03-22 08:56:15 -04:00
Benjamin Peterson
98ba753432
merge 3.2 ( #14378 )
2012-03-22 08:19:50 -04:00
Benjamin Peterson
a4e4e35783
check by equality for __future__ not identity ( closes #14378 )
2012-03-22 08:19:04 -04:00
Benjamin Peterson
302e7902c8
use identifier api
2012-03-20 23:17:04 -04:00
Larry Hastings
83a9f48699
Issue #14328 : Add keyword-only parameters to PyArg_ParseTupleAndKeywords.
...
They're optional-only for now (unlike in pure Python) but that's all
I needed. The syntax can easily be relaxed if we want to support
required keyword-only arguments for extension types in the future.
2012-03-20 20:06:16 +00:00
Gregory P. Smith
c809f98143
Fixes Issue #14331 : Use significantly less stack space when importing modules by
...
allocating path buffers on the heap instead of the stack.
2012-03-18 16:06:53 -07:00
Benjamin Peterson
01feaecbfa
plug memory leak ( closes #14325 )
2012-03-16 13:25:58 -05:00
Benjamin Peterson
eb74918685
kill capsule names that we don't need anymore
2012-03-16 12:24:01 -05:00
Benjamin Peterson
f7c132158d
use memory macros
2012-03-16 12:23:39 -05:00
Benjamin Peterson
7ed67270a8
check result of PyMem_New
2012-03-16 12:21:02 -05:00
Benjamin Peterson
f53d20f2cd
in 72556ff86828, I should have updated the magic as well as the comment ( #14230 )
2012-03-16 09:39:12 -05:00
Jean-Paul Calderone
c961b4abaa
Issue #14325 : Stop using python lists, capsules, and the garbage collector to deal with PyArg_Parse* cleanup.
2012-03-16 08:51:42 -04:00
Benjamin Peterson
abdb5528c0
fix comment
2012-03-15 15:40:37 -05:00
Benjamin Peterson
2afe6aeae8
perform yield from delegation by repeating YIELD_FROM opcode ( closes #14230 )
...
This allows generators that are using yield from to be seen by debuggers. It
also kills the f_yieldfrom field on frame objects.
Patch mostly from Mark Shannon with a few tweaks by me.
2012-03-15 15:37:39 -05:00
Benjamin Peterson
1767e0274b
free AST's dict
2012-03-14 21:50:29 -05:00
Ned Deily
577c830531
Issue #14184 : merge
2012-03-13 11:31:36 -07:00
Ned Deily
7ca97d5208
Issue #14184 : Increase the default stack size for secondary threads on
...
Mac OS X to prevent interpreter crashes when compiled on 10.7.
2012-03-13 11:18:18 -07:00
Victor Stinner
bd273c1ec3
Issue #14180 : Fix an invalid rounding when compiler optimization are enabled
...
Use volatile keyword to disable localy unsafe float optimizations.
2012-03-13 19:12:23 +01:00
Victor Stinner
3a31dd407a
Issue #14180 : Remove commented code
2012-03-13 13:50:34 +01:00
Victor Stinner
5d272cc6a2
Close #14180 : Factorize code to convert a number of seconds to time_t, timeval or timespec
...
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Victor Stinner
45e50de1f5
Try to fix compilation of Python-ast.c on Visual Studio 2008
2012-03-13 01:17:31 +01:00
Benjamin Peterson
518cf94ad7
merge 3.2
2012-03-12 11:16:03 -07:00
Benjamin Peterson
3f3584695e
kill this disabled code
2012-03-12 11:15:48 -07:00
Benjamin Peterson
bebcd18b75
merge 3.2
2012-03-12 11:02:10 -07:00
Benjamin Peterson
bc4665ebcb
use correct naming convention
2012-03-12 11:00:41 -07:00
Benjamin Peterson
7e0dbfbbde
give the AST class a __dict__
2012-03-12 09:46:44 -07:00
Georg Brandl
f125bf5f94
Update copyright years and version name.
2012-03-04 16:26:19 +01:00
Armin Ronacher
6ecf77b3f8
Basic support for PEP 414 without docs or tests.
2012-03-04 12:04:06 +00:00
Antoine Pitrou
0d3a003f24
- Issue #14177 : marshal.loads() now raises TypeError when given an unicode
...
string. Patch by Guilherme Gonçalves.
2012-03-03 02:38:37 +01:00
Antoine Pitrou
4a90ef0363
Issue #14177 : marshal.loads() now raises TypeError when given an unicode string.
...
Patch by Guilherme Gonçalves.
2012-03-03 02:35:32 +01:00
Victor Stinner
643cd68ea4
Issue #13964 : signal.sigtimedwait() timeout is now a float instead of a tuple
...
Add a private API to convert an int or float to a C timespec structure.
2012-03-02 22:54:03 +01:00
Antoine Pitrou
1c13f84f55
Simplify code in marshal.c.
2012-03-02 18:22:23 +01:00
Antoine Pitrou
b2677c7397
Issue #14172 : Fix reference leak when marshalling a buffer-like object (other than a bytes object).
2012-03-02 18:16:38 +01:00
Antoine Pitrou
679e9d36f7
Issue #14172 : Fix reference leak when marshalling a buffer-like object (other than a bytes object).
2012-03-02 18:12:43 +01:00
Brett Cannon
efb00c0cc1
Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
...
the os module.
2012-02-29 18:31:31 -05:00
Nick Coghlan
ab7bf2143e
Close issue #6210 : Implement PEP 409
2012-02-26 17:49:52 +10:00
Victor Stinner
90f50d4df9
Issue #13706 : Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF)
2012-02-24 01:44:47 +01:00
Victor Stinner
41a863cb81
Issue #13706 : Fix format(int, "n") for locale with non-ASCII thousands separator
...
* Decode thousands separator and decimal point using PyUnicode_DecodeLocale()
(from the locale encoding), instead of decoding them implicitly from latin1
* Remove _PyUnicode_InsertThousandsGroupingLocale(), it was not used
* Change _PyUnicode_InsertThousandsGrouping() API to return the maximum
character if unicode is NULL
* Replace MIN/MAX macros by Py_MIN/Py_MAX
* stringlib/undef.h undefines STRINGLIB_IS_UNICODE
* stringlib/localeutil.h only supports Unicode
2012-02-24 00:37:51 +01:00
Antoine Pitrou
cf1c8339f9
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
2012-02-22 18:08:30 +01:00
Antoine Pitrou
4f22a8d739
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
2012-02-22 18:05:43 +01:00
Antoine Pitrou
7214612443
In find_module(), do not silence fileno() and dup() errors.
2012-02-22 18:03:04 +01:00
Benjamin Peterson
c9f54cf512
enable hash randomization by default
2012-02-21 16:08:05 -05:00
Antoine Pitrou
528b54b263
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
2012-02-21 19:08:26 +01:00
Antoine Pitrou
86838b02f0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
2012-02-21 19:03:47 +01:00
Benjamin Peterson
d9a3591ed1
merge 3.2
2012-02-21 11:12:14 -05:00
Benjamin Peterson
e249dcab7a
merge 3.2
2012-02-21 11:09:13 -05:00
Benjamin Peterson
69e9727657
ensure no one tries to hash things before the random seed is found
2012-02-21 11:08:50 -05:00
Georg Brandl
2fb477c0f0
Merge 3.2: Issue #13703 plus some related test suite fixes.
2012-02-21 00:33:36 +01:00
Georg Brandl
91e5c08fe8
Fix typo in conditional.
2012-02-20 23:49:29 +01:00
Georg Brandl
12897d7d39
Fix typo in conditional.
2012-02-20 23:49:29 +01:00
Georg Brandl
09a7c72cad
Merge from 3.1: Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
...
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl
2daf6ae249
Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
...
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Antoine Pitrou
c229e6e8ff
Issue #14040 : Remove rarely used file name suffixes for C extensions (under POSIX mainly).
...
This will improve import performance a bit (especially under importlib).
2012-02-20 19:41:11 +01:00
Victor Stinner
4195b5caea
Backout f8409b3d6449: the PEP 410 is not accepted yet
2012-02-08 23:03:19 +01:00
Victor Stinner
ccd5715a14
PEP 410
2012-02-08 14:31:50 +01:00
Victor Stinner
09225b73c1
Issue #13845 : time.time() now uses GetSystemTimeAsFileTime() instead of ftime()
...
to have a resolution of 100 ns instead of 1 ms (the clock accuracy is between
0.5 ms and 15 ms).
2012-02-07 23:41:01 +01:00
Petri Lehtinen
4b0eab62f0
Merge branch 3.2
...
Closes #13402 .
2012-02-02 21:23:15 +02:00
Petri Lehtinen
9713321f46
Document absoluteness of sys.executable
...
Closes #13402 .
2012-02-02 20:59:50 +02:00
Victor Stinner
ed27785b32
Issue #13706 : Add assertions to detect bugs earlier
2012-02-01 00:22:23 +01:00
Victor Stinner
a3dd409b52
Remove now useless arbitrary limit of module name length
2012-01-26 00:31:49 +01:00
Antoine Pitrou
581616624d
Port import fixes from 2.7.
2012-01-25 18:06:07 +01:00
Antoine Pitrou
33d15f7c85
Port import fixes from 2.7.
2012-01-25 18:01:45 +01:00
Antoine Pitrou
abaf89b2be
Issue #11235 : Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
2012-01-24 17:45:50 +01:00
Antoine Pitrou
2be60afb7e
Issue #11235 : Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
2012-01-24 17:44:06 +01:00
Amaury Forgeot d'Arc
6d766fc3fa
Silence last compilation warning.
2012-01-23 23:20:43 +01:00
Amaury Forgeot d'Arc
cd27df3a99
Fix compilation warnings (seen on win32 buildbot)
2012-01-23 22:42:19 +01:00
Benjamin Peterson
ce79852077
use the static identifier api for looking up special methods
...
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
2012-01-22 11:24:29 -05:00
Victor Stinner
a4ac600d6f
Issue #13706 : Support non-ASCII fill characters
2012-01-21 15:50:49 +01:00
Eric V. Smith
d25cfe66f5
Improve exception text. Closes issue 13811.
2012-01-19 20:04:28 -05:00
Meador Inge
fa21bf015d
Issue #12705 : Raise SyntaxError when compiling multiple statements as single interactive statement
2012-01-19 01:08:41 -06:00
Antoine Pitrou
f0ecdd2ab9
Issue #13722 : Avoid silencing ImportErrors when initializing the codecs registry.
2012-01-18 22:31:12 +01:00
Antoine Pitrou
1b468af7be
Issue #13722 : Avoid silencing ImportErrors when initializing the codecs registry.
2012-01-18 22:30:21 +01:00
Antoine Pitrou
aa5c5c60f1
Finally fix all test_capi refleaks
2012-01-18 21:45:15 +01:00
Antoine Pitrou
165e01f83f
Fix the builtin module initialization code to store the init function for future reinitialization.
2012-01-18 20:17:58 +01:00
Antoine Pitrou
6c40eb7f42
Fix the builtin module initialization code to store the init function for future reinitialization.
2012-01-18 20:16:09 +01:00
Antoine Pitrou
fff47ab342
Fix a memory leak when initializing the standard I/O streams.
2012-01-18 15:28:38 +01:00
Antoine Pitrou
2fabface50
Fix a memory leak when initializing the standard I/O streams.
2012-01-18 15:14:46 +01:00
Benjamin Peterson
c64ae92bf1
fix indentation
2012-01-16 18:02:21 -05:00
Benjamin Peterson
c8909ddd28
break out switch at correct place
2012-01-16 17:44:12 -05:00
Benjamin Peterson
205ad61313
only finish error if one occurred
2012-01-16 17:31:43 -05:00
Benjamin Peterson
c0beabc2a5
move LINENO define to where it actually belongs
2012-01-16 17:29:05 -05:00
Benjamin Peterson
55e0043a51
streamline normalizer identification a bit
2012-01-16 17:22:31 -05:00
Benjamin Peterson
d3af6e30a2
fix spelling
2012-01-16 09:56:35 -05:00
Benjamin Peterson
de5827dcd2
invert condition (head bang)
2012-01-16 09:55:53 -05:00
Benjamin Peterson
0fa35ea8f3
fix possible refleaks
2012-01-16 09:50:48 -05:00
Benjamin Peterson
89f8b80202
use helpful PyUnicode_IS_ASCII macro
2012-01-16 09:49:20 -05:00
Benjamin Peterson
5eda913cd2
PyUnicode_DecodeUTF8 will always return a ready string
2012-01-16 09:47:42 -05:00
Benjamin Peterson
8f56e0909f
rewrite such that this actually makes sense
2012-01-16 09:42:36 -05:00
Meador Inge
da05f454e3
Issue #13629 : Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
2012-01-15 19:31:57 -06:00
Meador Inge
3388060127
Issue #13629 : Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
2012-01-15 19:15:36 -06:00
Benjamin Peterson
527c622926
make YieldFrom its own distinct from Yield ( closes #13780 )
2012-01-14 08:58:23 -05:00
Amaury Forgeot d'Arc
0a239e9191
Fix compilation with C89 compilers (Windows...)
2012-01-13 21:08:49 +01:00
Benjamin Peterson
0010256de4
fold into one if statement
2012-01-11 21:00:16 -05:00
Benjamin Peterson
a12d5c62f7
fix formatting
2012-01-03 16:47:22 -06:00
Benjamin Peterson
f606e682a4
add another year to glorious PSF IP
2011-12-31 22:42:26 -06:00
Benjamin Peterson
0296a56520
NULL and no exception set from tp_iternext means StopIteration
2012-01-13 14:54:31 -05:00
Georg Brandl
bc3b682923
Closes #13761 : add a "flush" keyword argument to print().
2012-01-13 19:41:25 +01:00
Antoine Pitrou
5136ac0ca2
Issue #13645 : pyc files now contain the size of the corresponding source
...
code, to avoid timestamp collisions (especially on filesystems with a low
timestamp resolution) when checking for freshness of the bytecode.
2012-01-13 18:52:16 +01:00
Nick Coghlan
1f7ce62bd6
Implement PEP 380 - 'yield from' ( closes #11682 )
2012-01-13 21:43:40 +10:00
Antoine Pitrou
3a5d4cb940
Issue #13748 : Raw bytes literals can now be written with the `rb` prefix as well as `br`.
2012-01-12 22:46:19 +01:00
Benjamin Peterson
0ab2a26865
merge 3.2
2012-01-11 21:00:48 -05:00
Benjamin Peterson
21e0da228d
remove some usage of Py_UNICODE_TOUPPER/LOWER
2012-01-11 21:00:42 -05:00
Victor Stinner
3fe553160c
Add a new PyUnicode_Fill() function
...
It is faster than the unicode_fill() function which was implemented in
formatter_unicode.c.
2012-01-04 00:33:50 +01:00
Benjamin Peterson
332503db07
merge 3.2
2012-01-03 16:48:14 -06:00
Benjamin Peterson
a174577f55
merge 3.2
2011-12-31 22:43:01 -06:00
Antoine Pitrou
0e576f1f50
Issue #13626 : Add support for SSL Diffie-Hellman key exchange, through the
...
SSLContext.load_dh_params() method and the ssl.OP_SINGLE_DH_USE option.
2011-12-22 10:03:38 +01:00
Antoine Pitrou
2b1cc89572
_Py_fopen now allows bytes filenames under non-Windows platforms.
2011-12-19 18:19:06 +01:00
Victor Stinner
3573476271
(Merge 3.2) Handle correctly _Py_fopen() error: don't replace the exception
2011-12-18 21:05:22 +01:00
Victor Stinner
bd0850b857
import.c now catchs _Py_stat() exceptions
...
_Py_stat() now returns -2 if an exception was raised.
2011-12-18 20:47:30 +01:00
Victor Stinner
1b57967b96
Issue #13560 : Locale codec functions use the classic "errors" parameter,
...
instead of surrogateescape
So it would be possible to support more error handlers later.
2011-12-17 05:47:23 +01:00
Victor Stinner
1f33f2b0c3
Issue #13560 : os.strerror() now uses the current locale encoding instead of UTF-8
2011-12-17 04:45:09 +01:00
Victor Stinner
af02e1c85a
Add PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale()
...
* PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale() decode a string
from the current locale encoding
* _Py_char2wchar() writes an "error code" in the size argument to indicate
if the function failed because of memory allocation failure or because of a
decoding error. The function doesn't write the error message directly to
stderr.
* Fix time.strftime() (if wcsftime() is missing): decode strftime() result
from the current locale encoding, not from the filesystem encoding.
2011-12-16 23:56:01 +01:00
Florent Xicluna
aa6c1d240f
Issue #13575 : there is only one class type.
2011-12-12 18:54:29 +01:00
Florent Xicluna
720682efd1
Merge 3.2
2011-12-09 23:42:29 +01:00
Florent Xicluna
5126df602c
Remove obsolete py3k comment.
2011-12-09 23:41:21 +01:00
Charles-François Natali
1659b83b1d
Followup to a541bda2f5e2: Add a short comment.
2011-12-07 23:17:58 +01:00
Charles-François Natali
7c0b0cc9f9
Issue #11051 : Reduce the number of syscalls per import.
2011-12-07 19:16:01 +01:00
Mark Dickinson
47862d4c0e
Issue #9530 : Fix undefined behaviour due to signed overflow in Python/formatter_unicode.c.
2011-12-01 15:27:04 +00:00
Victor Stinner
ee450093a9
PyCodec_IgnoreErrors() avoids the deprecated "u#" format
2011-12-01 02:52:11 +01:00
Antoine Pitrou
39a73a4cfa
Issue #7111 : Python can now be run without a stdin, stdout or stderr stream.
...
It was already the case with Python 2. However, the corresponding
sys module entries are now set to None (instead of an unusable file object).
2011-11-28 19:09:45 +01:00
Antoine Pitrou
11942a58a1
Issue #7111 : Python can now be run without a stdin, stdout or stderr stream.
...
It was already the case with Python 2. However, the corresponding
sys module entries are now set to None (instead of an unusable file object).
2011-11-28 19:08:36 +01:00
Antoine Pitrou
5604ef3e36
Issue #13444 : When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
...
This also adds a test for issue #5319 , whose resolution introduced the issue.
2011-11-26 22:02:29 +01:00
Antoine Pitrou
d7c8fbf89e
Issue #13444 : When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
...
This also adds a test for issue #5319 , whose resolution introduced the issue.
2011-11-26 21:59:36 +01:00
Antoine Pitrou
86a36b500a
PEP 3155 / issue #13448 : Qualified name for classes and functions.
2011-11-25 18:56:07 +01:00
Amaury Forgeot d'Arc
942d5ba125
Merge branch 3.2
2011-11-22 22:02:01 +01:00
Amaury Forgeot d'Arc
5e8f810411
Issue #13436 : commit regenerated Python-ast.c
2011-11-22 21:52:30 +01:00
Charles-François Natali
23b0b9252e
Issue #13156 : _PyGILState_Reinit(): Re-associate the auto thread state with the
...
TLS key only if the thread that called fork() had an associated auto thread
state (this might not be the case for example for a thread created outside of
Python calling into a subinterpreter).
2011-11-22 19:51:14 +01:00
Charles-François Natali
a233df885b
Issue #13156 : _PyGILState_Reinit(): Re-associate the auto thread state with the
...
TLS key only if the thread that called fork() had an associated auto thread
state (this might not be the case for example for a thread created outside of
Python calling into a subinterpreter).
2011-11-22 19:49:51 +01:00
Victor Stinner
63ab875cfe
Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide
2011-11-22 03:31:20 +01:00
Victor Stinner
9d3b93ba30
Use the new Unicode API
...
* Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)
* Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len)
* Replace Py_UNICODE by wchar_t
* posix_putenv() uses PyUnicode_FromFormat() to create the string, instead
of PyUnicode_FromUnicode() + _snwprintf()
2011-11-22 02:27:30 +01:00
Victor Stinner
9e30aa52fd
Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
...
And PyUnicode_GetSize() => PyUnicode_GetLength()
2011-11-21 02:49:52 +01:00
Victor Stinner
3335447646
Check for PyUnicode_AS_UNICODE() failure
2011-11-21 02:01:41 +01:00
Victor Stinner
e251d6d69d
print_exception() uses PyUnicode_GetLength() instead of PyUnicode_GetSize()
2011-11-20 19:20:00 +01:00
Antoine Pitrou
f34a0cdc6c
Issue #10227 : Add an allocation cache for a single slice object.
...
Patch by Stefan Behnel.
2011-11-18 20:14:34 +01:00
Victor Stinner
ee587eaa36
Catch PyUnicode_AS_UNICODE() errors in fileutils.c
2011-11-17 00:51:38 +01:00
Victor Stinner
1f7951711c
Catch PyUnicode_AS_UNICODE() errors
2011-11-17 00:45:54 +01:00
Antoine Pitrou
8ad982cccf
Use PyUnicode_FromFormat() to create the temporary file name.
...
Also, as in importlib, append the id of an object to make the file name
pseudo-random.
2011-11-15 22:27:32 +01:00
Antoine Pitrou
1d8f3f451c
Fix regression under Windows following b75b41237380 (from issue #13392 )
2011-11-15 20:40:55 +01:00
Antoine Pitrou
28e401e717
Issue #13392 : Writing a pyc file should now be atomic under Windows as well.
2011-11-15 19:15:19 +01:00
Charles-François Natali
0c929d9d39
Issue #13303 : Fix bytecode file default permission.
2011-11-10 19:12:29 +01:00
Martin v. Löwis
d10759f6ed
Make _PyUnicode_FromId return borrowed references.
...
http://mail.python.org/pipermail/python-dev/2011-November/114347.html
2011-11-07 13:00:05 +01:00
Philip Jenvey
50add04836
quote the type name for improved readability
2011-11-06 16:37:52 -08:00
Antoine Pitrou
5ee9d8a8a2
Issue #13342 : input() used to ignore sys.stdin's and sys.stdout's unicode
...
error handler in interactive mode (when calling into PyOS_Readline()).
2011-11-06 00:38:45 +01:00
Antoine Pitrou
0d776b1ce8
Issue #13342 : input() used to ignore sys.stdin's and sys.stdout's unicode
...
error handler in interactive mode (when calling into PyOS_Readline()).
2011-11-06 00:34:26 +01:00
Amaury Forgeot d'Arc
9028a10144
Issue #13343 : Fix a SystemError when a lambda expression uses a global
...
variable in the default value of a keyword-only argument:
(lambda *, arg=GLOBAL_NAME: None)
2011-11-04 22:29:24 +01:00
Amaury Forgeot d'Arc
97c1bef6a4
Issue #13343 : Fix a SystemError when a lambda expression uses a global
...
variable in the default value of a keyword-only argument:
(lambda *, arg=GLOBAL_NAME: None)
2011-11-04 22:17:45 +01:00
Victor Stinner
c06bb7affd
Avoid the Py_UNICODE type in codecs.c
2011-11-04 21:36:35 +01:00
Victor Stinner
b31f1bcd99
PyCodec_XMLCharRefReplaceError(): Remove unused variable
2011-11-04 21:29:10 +01:00
Martin v. Löwis
8ba79306d1
Fix C89 incompatibility.
2011-11-04 12:26:49 +01:00
Martin v. Löwis
b09af03b8a
Port error handlers from Py_UNICODE indexing to code point indexing.
2011-11-04 11:16:41 +01:00
Éric Araujo
e64052176d
Merge follow-up for #11254 and other changes from 3.2
2011-11-03 05:17:11 +01:00
Éric Araujo
5df1108de2
Add signatures to the docstring of functions added to imp by PEP 3147
2011-11-03 03:38:44 +01:00
Antoine Pitrou
8db076cf8a
Issue #10363 : Deallocate global locks in Py_Finalize().
2011-10-30 19:13:55 +01:00
Florent Xicluna
4d46c2a722
Remove unused variable.
2011-10-28 15:00:50 +02:00
Nick Coghlan
de31b191e5
Issue 1294232: Fix errors in metaclass calculation affecting some cases of metaclass inheritance. Patch by Daniel Urban.
2011-10-23 22:04:16 +10:00
Charles-François Natali
e695eec24a
Issue #13303 : Fix a race condition in the bytecode file creation.
2011-10-31 20:47:31 +01:00
Victor Stinner
f4afa43fd4
Issue #13226 : Update sys.setdlopenflags() docstring
...
Refer to os.RTLD_xxx constants instead of ctypes and DLFCN modules.
2011-10-31 11:48:09 +01:00
Martin v. Löwis
f45dee998f
Port import_module_level to Unicode API.
2011-10-30 23:50:02 +01:00
Antoine Pitrou
6fbbc33440
Issue #10363 : Deallocate global locks in Py_Finalize().
2011-10-30 19:14:46 +01:00
Martin v. Löwis
796ea53937
Port PyImport_ReloadModule to Unicode API.
2011-10-30 09:07:07 +01:00
Florent Xicluna
908ae24b06
Merge 3.2 (linked to issue #1294232 )
2011-10-28 15:06:13 +02:00
Antoine Pitrou
b528fcf954
Fix test_imp failure under Windows
2011-10-25 00:21:02 +02:00
Martin v. Löwis
9af29d39af
Rewrite find_module_path using unicode API.
2011-10-23 18:45:16 +02:00
Martin v. Löwis
2cc0cc54a2
Fix off-by-one error.
2011-10-23 18:41:56 +02:00
Martin v. Löwis
fadcd317fa
Drop unused macros. Use CACHEDIR consistently.
2011-10-23 18:08:20 +02:00
Martin v. Löwis
8a0ef78e8c
Rewrite make_source_pathname using Unicode API.
2011-10-23 18:05:06 +02:00
Martin v. Löwis
30260a7fe3
Add ready checks for make_compiled_pathname.
2011-10-23 17:35:46 +02:00
Martin v. Löwis
2db72863fb
Reformulate make_compiled_pathname in terms of unicode objects.
2011-10-23 17:29:08 +02:00
Nick Coghlan
9715d26305
Merge issue 1294232 patch from 3.2
2011-10-23 22:36:42 +10:00
Victor Stinner
3a50e7056e
Issue #12281 : Rewrite the MBCS codec to handle correctly replace and ignore
...
error handlers on all Windows versions. The MBCS codec is now supporting all
error handlers, instead of only replace to encode and ignore to decode.
2011-10-18 21:21:00 +02:00
Victor Stinner
9ea8e4c29d
Instantiate the OS-related exception as soon as we raise it, so that "except"
...
works properly.
PyErr_SetFromErrnoWithFilenameObject() was already fixed by the changeset
793c75177d28. This commit fixes PyErr_SetExcFromWindowsErrWithFilenameObject(),
used on Windows.
2011-10-17 20:18:58 +02:00
Antoine Pitrou
707033a694
Issue #13146 : Writing a pyc file is now atomic under POSIX.
2011-10-17 19:28:44 +02:00
Martin v. Löwis
1c67dd9b15
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
2011-10-14 15:16:45 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Victor Stinner
f5cff56a1b
Issue #13088 : Add shared Py_hexdigits constant to format a number into base 16
2011-10-14 02:13:11 +02:00
Victor Stinner
9d663d0788
convertsimple(): "str without bytes" => "str without characters"
2011-10-13 23:25:03 +02:00
Antoine Pitrou
5d6fbe8207
Instantiate the OS-related exception as soon as we raise it, so that
...
"except" works properly.
2011-10-12 19:39:57 +02:00
Antoine Pitrou
6b4883dec0
PEP 3151 / issue #12555 : reworking the OS and IO exception hierarchy.
2011-10-12 02:54:14 +02:00
Victor Stinner
8c9818980b
Fix typo in import.c
2011-10-11 22:27:13 +02:00
Victor Stinner
c4f281eba3
Fix misuse of PyUnicode_GET_SIZE, use PyUnicode_GET_LENGTH instead
2011-10-11 22:11:42 +02:00
Victor Stinner
beac78bb24
Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE()
2011-10-11 21:55:01 +02:00
Martin v. Löwis
1ee1b6fe0d
Use identifier API for PyObject_GetAttrString.
2011-10-10 18:11:30 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Martin v. Löwis
c47adb04b3
Change PyUnicode_KIND to 1,2,4. Drop _KIND_SIZE and _CHARACTER_SIZE.
2011-10-07 20:55:35 +02:00
Victor Stinner
46084bad88
Fix find_module_path(): make the string ready
2011-10-06 02:39:42 +02:00
Victor Stinner
b62a7b268a
Fix _warnings.c: make the filename string ready
2011-10-06 02:34:51 +02:00
Victor Stinner
fb9ea8c57e
Don't check for the maximum character when copying from unicodeobject.c
...
* Create copy_characters() function which doesn't check for the maximum
character in release mode
* _PyUnicode_CheckConsistency() is no more static to be able to use it
in _PyUnicode_FormatAdvanced() (in formatter_unicode.c)
* _PyUnicode_CheckConsistency() checks the string hash
2011-10-06 01:45:57 +02:00
Victor Stinner
a336de7ae1
traceback: fix dump_ascii() for string with kind=PyUnicode_WCHAR_KIND
2011-10-05 22:44:12 +02:00
Victor Stinner
c3cec7868b
Add asciilib: similar to ucs1, ucs2 and ucs4 library, but specialized to ASCII
...
ucs1, ucs2 and ucs4 libraries have to scan created substring to find the
maximum character, whereas it is not need to ASCII strings. Because ASCII
strings are common, it is useful to optimize ASCII.
2011-10-05 21:24:08 +02:00
Victor Stinner
e1335c711c
Fix usage og PyUnicode_READY()
2011-10-04 20:53:03 +02:00
Victor Stinner
d2a915dbf6
ceval.c: restore str+=str optimization
2011-10-02 20:34:20 +02:00
Victor Stinner
67002af323
Check error when calling PyUnicode_AppendAndDel()
2011-10-02 20:35:10 +02:00
Victor Stinner
1a15aba71d
PyCodec_ReplaceErrors() uses "C" format instead of "u#" to build result
2011-10-02 19:00:15 +02:00
Benjamin Peterson
014cc42db8
remove unused label
2011-10-02 13:19:16 -04:00
Martin v. Löwis
0b1d348990
Issue 13085: Fix some memory leaks. Patch by Stefan Krah.
2011-10-01 16:35:40 +02:00
Benjamin Peterson
811c2f1369
remove "fast-path" for (i)adding strings
...
These were just an artifact of the old unicode concatenation hack and likely
just penalized other kinds of adding. Also, this fixes __(i)add__ on string
subclasses.
2011-09-30 21:31:21 -04:00
Victor Stinner
bec0fda264
Remove commented code: str+=str is no more super-optimized
2011-10-01 01:26:08 +02:00
Victor Stinner
d9c563e84d
modsupport.c reuses Py_UNICODE_strlen()
2011-09-29 04:01:43 +02:00
Victor Stinner
639418812f
Use the new Py_ARRAY_LENGTH macro
2011-09-29 00:42:28 +02:00
Ezio Melotti
48a2f8fd97
#13054 : sys.maxunicode is now always 0x10FFFF.
2011-09-29 00:18:19 +03:00
Victor Stinner
fd85c3aa8d
fill_number() and format_string_internal() check for PyUnicode_CopyCharacters() failure
2011-09-28 21:53:49 +02:00
Victor Stinner
dba2deeca2
fill_number() ensures that the 'digits' string is ready
2011-09-28 21:50:42 +02:00
Victor Stinner
afbaa20fb9
fill_char() can now propagate an error
2011-09-28 21:50:16 +02:00
Victor Stinner
6c7a52a46f
Check for PyUnicode_CopyCharacters() failure
2011-09-28 21:39:17 +02:00
Georg Brandl
4cb0de246c
Rename new macros to conform to naming rules (function macros have "Py" prefix, not "PY").
2011-09-28 21:49:49 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Victor Stinner
a1fe1f8dcf
Merge 3.2: Issue #7732 : Don't open a directory as a file anymore while
...
importing a module. Ignore the direcotry if its name matchs the module name
(e.g. "__init__.py") and raise a ImportError instead.
2011-09-23 18:59:08 +02:00
Victor Stinner
53ffdc53bf
Issue #7732 : Don't open a directory as a file anymore while importing a
...
module. Ignore the direcotry if its name matchs the module name (e.g.
"__init__.py") and raise a ImportError instead.
2011-09-23 18:54:40 +02:00
Stefan Krah
472d280d8b
Issue #13002 : Fix Visual Studio warning (not enough actual parameters).
2011-09-21 19:08:39 +02:00
Barry Warsaw
a80b14cc5f
- Issue #13021 : Missing decref on an error path. Thanks to Suman Saha for
...
finding the bug and providing a patch.
2011-09-20 14:58:01 -04:00
Barry Warsaw
916048d780
- Issue #13021 : Missing decref on an error path. Thanks to Suman Saha for
...
finding the bug and providing a patch.
2011-09-20 14:45:44 -04:00
Victor Stinner
9561d7c526
import.c: remove now useless arbitrary limit
2011-09-15 19:50:01 +02:00
Victor Stinner
84b8e40fd7
Merge 3.2: Fix the import machinery if there is an error on sys.path or sys.meta_path
...
find_module() now raises a RuntimeError, instead of ImportError, on an error on
sys.path or sys.meta_path because load_package() and import_submodule() returns
None and clear the exception if a ImportError occurred.
2011-09-15 19:38:54 +02:00
Victor Stinner
1619132e5d
Fix the import machinery if there is an error on sys.path or sys.meta_path
...
find_module() now raises a RuntimeError, instead of ImportError, on an error on
sys.path or sys.meta_path because load_package() and import_submodule() returns
None and clear the exception if a ImportError occurred.
2011-09-15 19:28:05 +02:00
Éric Araujo
6f08f53e79
Merge 3.2
2011-09-02 17:32:30 +02:00
Victor Stinner
22d80bcf1b
Merge 3.2: Remove unused variable if Python is build without threads
2011-09-02 00:13:16 +02:00
Victor Stinner
0af0306396
Remove unused variable if Python is build without threads
2011-09-02 00:11:43 +02:00
Benjamin Peterson
0224d4e699
accept bytes for the AST 'string' type
...
This is a temporary kludge and all is well in 3.3.
2011-08-31 22:13:03 -04:00
Benjamin Peterson
ea281a54f3
include header with PyAST_Validate
2011-08-12 23:10:50 -05:00
Benjamin Peterson
832bfe2ebd
add a AST validator ( closes #12575 )
2011-08-09 16:15:04 -05:00
Benjamin Peterson
e249841903
add a asdl bytes type, so Bytes.s be properly typechecked
2011-08-09 16:08:39 -05:00
Benjamin Peterson
405f32c14c
plug refleak
2011-07-29 22:43:45 -05:00
Benjamin Peterson
4f921c2e06
bytes -> bytearray
2011-07-29 14:24:29 -05:00
Benjamin Peterson
ce071ca4e7
bytes should be verboten in sum() ( fixes #12654 )
2011-07-29 14:23:47 -05:00
Éric Araujo
0bbacc621c
Branch merge
2011-07-29 14:30:03 +02:00
Eli Bendersky
906b88fb2a
Issue #12380 : PyArg_ParseTuple now accepts a bytearray for the 'c' format.
...
As a side effect, this now allows the rjust, ljust and center methods of
bytes and bytearray to accept a bytearray argument.
Patch by Petri Lehtinen
2011-07-29 07:05:08 +03:00
Éric Araujo
2527796a22
Merge from 3.2 ( #10318 , #12255 , #12043 , #12417 and other fixes)
2011-07-29 03:11:09 +02:00
Éric Araujo
6c0ba447bd
Fix style in code added by edba722f3b02
2011-07-26 17:23:57 +02:00
Antoine Pitrou
5a24d82941
Add a test for issue #1813 : getlocale() failing under a Turkish locale
...
(not a problem under 3.x)
2011-07-24 02:41:54 +02:00
Antoine Pitrou
cf9d3c08c8
Issue #1813 : Fix codec lookup under Turkish locales.
2011-07-24 02:27:04 +02:00
Charles-François Natali
f23339a7bb
Issue 12620: Make pendingbusy flag static to Py_MakePendingCalls().
2011-07-23 18:15:43 +02:00
Benjamin Peterson
8a4b42b7f4
merge 3.2
2011-07-22 11:10:43 -05:00
Benjamin Peterson
180e63507d
None is ok for identifiers but not strings
2011-07-22 11:09:07 -05:00
Benjamin Peterson
86f088e8e5
merge 3.2
2011-07-22 10:55:02 -05:00
Benjamin Peterson
2193d2b72b
type check AST strings and identifiers
...
This is related to a21829180423 as well as #12609 and #12610 .
2011-07-22 10:50:23 -05:00
Benjamin Peterson
efad2449fc
hardcode the old svn __version__
2011-07-22 10:39:12 -05:00
Benjamin Peterson
bd9c655c97
merge heads
2011-07-17 22:50:12 -05:00
Benjamin Peterson
76f7f4d979
excise the remains of STOP_CODE, which hasn't done anything useful for years
2011-07-17 22:49:50 -05:00
Brett Cannon
52a7d98273
Make warnings accept a callable for showwarnings instead of
...
restricting itself to just functions and methods (which allows
built-in functions to be used, etc.).
Closes issue #10271 . Thanks to lekma for the bug report.
2011-07-17 19:17:55 -07:00
Benjamin Peterson
0bd152cd67
remove ast.__version__ ( closes #12273 )
2011-07-15 21:10:13 -05:00
Benjamin Peterson
e92cd0ce98
merge 3.2 ( #11627 )
2011-07-15 14:10:35 -05:00
Benjamin Peterson
5afa03a72e
catch nasty exception classes with __new__ that doesn't return a exception ( closes #11627 )
...
Patch from Andreas Stührk.
2011-07-15 14:09:26 -05:00
Victor Stinner
ecf4fdad50
Py_BuildValue("C") supports non-BMP characters on narrow build
...
Py_BuildValue("C") doesn't have to check the code point,
PyUnicode_FromOrdinal() checks its input and now supports non-BMP characters
(range U+10000-U+10FFFF).
2011-07-15 01:13:24 +02:00
Antoine Pitrou
370092071b
Issue #11863 : Remove support for legacy systems deprecated in Python 3.2
...
(following PEP 11). These systems are systems using Mach C Threads,
SunOS lightweight processes, GNU pth threads and IRIX threads.
2011-07-08 23:47:50 +02:00
Antoine Pitrou
022ae22cc6
Issue #11863 : remove unused file Python/thread_wince.h
2011-07-08 23:37:39 +02:00
Benjamin Peterson
9797e29f86
merge 3.2
2011-07-04 22:28:00 -05:00
Benjamin Peterson
bb4a747b69
start out this branch always with filename NULL
2011-07-04 22:27:16 -05:00
Victor Stinner
87e78ce1c6
Issue #12469 : partial revert of 024827a9db64, freebsd6 thread initialization
...
* Don't create a thread at startup anymore to initialize the pthread library:
it changes the behaviour of many functions related to signal handling like
sigwait()
* Reenable test_sigtimedwait_poll() on FreeBSD 6
2011-07-04 22:53:49 +02:00
Victor Stinner
99b9538636
Issue #9642 : Uniformize the tests on the availability of the mbcs codec
...
Add a new HAVE_MBCS define.
2011-07-04 14:23:54 +02:00
Victor Stinner
d64e8a75e5
Issue #9642 : Fix filesystem encoding initialization: use the ANSI code page on
...
Windows if the mbcs codec is not available, and fail with a fatal error if we
cannot get the locale encoding (if nl_langinfo(CODESET) is not available)
instead of using UTF-8.
2011-07-04 13:48:30 +02:00
Benjamin Peterson
401d197657
merge 3.2
2011-07-03 22:19:29 -05:00
Benjamin Peterson
a55007a620
plug refleak
2011-07-03 22:18:34 -05:00
Victor Stinner
5a21e83119
(merge 3.2) Issue #12467 : warnings: fix a race condition if a warning is
...
emitted at shutdown, if globals()['__file__'] is None.
2011-07-04 02:56:10 +02:00
Victor Stinner
8b0508ed4e
Issue #12467 : warnings: fix a race condition if a warning is emitted at
...
shutdown, if globals()['__file__'] is None.
2011-07-04 02:43:09 +02:00
Benjamin Peterson
9bfd0dee9b
no one passes NULL here (or should anyway)
2011-07-03 17:06:32 -05:00
Benjamin Peterson
878802435d
convert generator exc state functions into static functions
2011-07-03 16:48:31 -05:00
Benjamin Peterson
536feac7f8
merge 3.2
2011-07-03 16:27:41 -05:00
Benjamin Peterson
ac91341333
never retain a generator's caller's exception state on the generator after a yield/return
...
This requires some trickery to properly save the exception state if the
generator creates its own exception state.
2011-07-03 16:25:11 -05:00
Benjamin Peterson
7b7099c36f
merge 3.2 ( #12475 )
2011-07-03 13:48:36 -05:00
Benjamin Peterson
d2ed630243
merge heads
2011-07-03 13:44:56 -05:00
Benjamin Peterson
83195c3f0c
restore a generator's caller's exception state both on yield and (last) return
...
This prevents generator exception state from leaking into the caller.
Closes #12475 .
2011-07-03 13:44:00 -05:00
Vinay Sajip
aac0f75b3b
Correct uninitialized data problem in marshal code.
2011-07-02 18:42:21 +01:00
Vinay Sajip
3232284391
Removed breaking typo accidentally introduced during merge with 3.2.
2011-07-02 17:19:51 +01:00
Vinay Sajip
65897a386e
Closes #12291 for 3.3 - merged fix from 3.2.
2011-07-02 17:16:02 +01:00
Vinay Sajip
5bdae3bb7c
Closes #12291 : Fixed bug which was found when doing multiple loads from one stream.
2011-07-02 16:42:47 +01:00
Benjamin Peterson
9d872e19aa
fix possibily uninitialized memory usage ( closes #12474 )
2011-07-02 09:22:13 -05:00
Benjamin Peterson
609da58ae5
store the current scope on the stack right away
2011-06-29 22:52:39 -05:00
Benjamin Peterson
c2575d55cd
remove VISIT_*_IN_BLOCK macros
...
These are pointless because on error, all blocks will be finalized by
symtable_dealloc.
2011-06-29 15:27:14 -05:00
Benjamin Peterson
9003760991
map cells to arg slots at code creation time ( closes #12399 )
...
This removes nested loops in PyEval_EvalCodeEx.
2011-06-25 22:54:45 -05:00
Victor Stinner
e71db4450c
Issue #12392 : fix thread initialization on FreeBSD 6
...
On FreeBSD6, pthread_kill() doesn't work on the main thread before the creation
of the first thread. Create therefore a dummy thread (no-op) a startup to
initialize the pthread library.
Add also a test for this use case, test written by Charles-François Natali.
2011-06-24 20:52:27 +02:00
Benjamin Peterson
e109c70860
give the names of missing positional or keyword-only arguments ( closes #12356 )
2011-06-24 09:37:26 -05:00
Benjamin Peterson
28db0fd357
merge 3.2
2011-06-20 22:09:20 -05:00
Benjamin Peterson
b7149cad04
fix indentation
2011-06-20 22:09:13 -05:00
Benjamin Peterson
267ca6cb23
merge 3.2
2011-06-20 21:40:46 -05:00
Benjamin Peterson
f63d615f8b
fix indentation
2011-06-20 21:40:19 -05:00
Victor Stinner
d417d01ec8
call_find_module() handles dup() failure: raise an OSError exception
2011-06-20 15:16:55 +02:00
Victor Stinner
925ef39949
find_module_path_list() fails if _Py_fopen() failed and raised an exception
...
(UnicodeEncodeError).
2011-06-20 15:01:10 +02:00
Benjamin Peterson
e7c15fa184
bump magic for super closure change
2011-06-19 19:54:45 -05:00
Benjamin Peterson
f5ff22329b
use a invalid name for the __class__ closure for super() ( closes #12370 )
...
This prevents the assignment of __class__ in the class body from breaking
super. (Although a determined person could do locals()["@__class__"] = 4)
2011-06-19 19:42:22 -05:00
Brian Curtin
589f89e2ad
Removed a Windows 9x trick used before LoadLibraryExW.
...
Windows 9x has long been unsupported and the result of GetFullPathName
was not even being used in the first place.
2011-06-09 17:55:54 -05:00
Benjamin Peterson
b204a42383
greatly improve argument parsing error messages ( closes #12265 )
2011-06-05 22:04:07 -05:00
Benjamin Peterson
48deae12d5
some horrible preprocessing tricks to automatically update the tag
2011-06-03 17:50:16 -05:00
Vinay Sajip
623e8b86af
Removed some unused local variables.
2011-07-02 17:21:37 +01:00
Benjamin Peterson
04a90b4611
bump ast version
2011-05-29 11:45:29 -05:00
Benjamin Peterson
43af12b0b4
unify TryExcept and TryFinally ( closes #12199 )
2011-05-29 11:43:10 -05:00
Ned Deily
61be422bd7
Issue #9670 : Increase the default stack size for secondary threads on
...
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(patch by Ronald Oussoren)
2011-05-28 00:45:52 -07:00
Ned Deily
056f5b9dad
Issue #9670 : Increase the default stack size for secondary threads on
...
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(patch by Ronald Oussoren)
2011-05-28 00:36:12 -07:00
Ned Deily
9a7c524dc6
Issue #9670 : Increase the default stack size for secondary threads on
...
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(patch by Ronald Oussoren)
2011-05-28 00:19:56 -07:00
Benjamin Peterson
d8255e0e9e
merge 3.2
2011-05-27 14:17:35 -05:00
Benjamin Peterson
a290bac5b1
merge 3.1
2011-05-27 14:17:19 -05:00
Benjamin Peterson
0a5dad9ef1
fix spacing
2011-05-27 14:17:04 -05:00
Benjamin Peterson
4a0f20f5a3
merge 3.2
2011-05-27 14:12:53 -05:00
Benjamin Peterson
5218853c67
merge 3.1
2011-05-27 14:10:36 -05:00
Benjamin Peterson
74897ba46f
fix indentation
2011-05-27 14:10:24 -05:00
Benjamin Peterson
7f670e5dad
bump ast version
2011-05-27 14:01:01 -05:00
Benjamin Peterson
bf1bbc1452
reflect with statements with multiple items in the AST ( closes #12106 )
2011-05-27 13:58:08 -05:00
Victor Stinner
4f2dab5c33
Revert my commit 7ba176c2f558: "Avoid useless "++" at the end of functions
...
Warnings found by the Clang Static Analyzer."
Most people prefer ++ at the end of functions.
2011-05-27 16:46:51 +02:00
Benjamin Peterson
43b068648e
try to use the same str object for all code filenames when compiling or unmarshalling ( #12190 )
...
This should reduce memory usage.
2011-05-27 09:08:01 -05:00
Benjamin Peterson
d408503b2c
remove unused string WILFE attribute
2011-05-27 07:53:28 -05:00
Victor Stinner
13b21bd749
print_exception(): handle correctly PyObject_GetAttrString() failure
...
Bug found by the Clang Static Analyzer.
2011-05-26 14:25:13 +02:00
Victor Stinner
97e561ef24
Avoid useless "++" at the end of functions
...
Warnings found by the Clang Static Analyzer.
2011-05-26 13:53:47 +02:00
Victor Stinner
25095b2be6
Remove useless assignments
...
Warnings found by the the Clang Static Analyzer.
2011-05-26 13:47:08 +02:00
Benjamin Peterson
04778a8150
make PyImport_ImportModuleLevel's first arg const like similiar functions ( closes #12173 )
2011-05-25 09:29:00 -05:00
Victor Stinner
118ed71afe
(Merge 3.2) Issue #11614 : import __hello__ prints "Hello World!". Patch written
...
by Andreas Stührk.
2011-05-16 16:35:35 +02:00
Victor Stinner
9cd6626f3d
(Merge 3.1) Issue #11614 : import __hello__ prints "Hello World!". Patch written
...
by Andreas Stührk.
2011-05-16 16:32:33 +02:00
Victor Stinner
c77b931196
Issue #11614 : import __hello__ prints "Hello World!". Patch written by Andreas
...
Stührk.
2011-05-16 16:29:35 +02:00
Georg Brandl
1a4de20d95
Merge #6498 fix from 3.2.
2011-05-15 08:49:38 +02:00
Georg Brandl
318e62153b
Merge #6498 fix from 3.1.
2011-05-15 08:49:29 +02:00
Georg Brandl
0b2489e986
Closes #6498 : fix several misspellings of "SystemExit" as "SystemError".
2011-05-15 08:49:12 +02:00
Victor Stinner
65b7eff7c7
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
...
The name must be encodable to ASCII because dynamic module must have a function
called "PyInit_NAME", they are written in C, and the C language doesn't accept
non-ASCII identifiers.
2011-05-07 12:46:05 +02:00
Victor Stinner
7bba62fd68
faulthandler: dump all threads by default
...
* Set the default value of all_threads arguments to True
* Py_FatalError() dumps all threads, instead of only the current thread
Dump only the current thread is not reliable. In some cases, Python is unable
to retrieve the state of the current thread and so is unable to dump the
traceback. faulthandler keeps a reference to the interpreter and so is always
able to dump the traceback of all threads.
2011-05-07 12:43:00 +02:00
Antoine Pitrou
fc20b0c65c
Issue #1856 : Avoid crashes and lockups when daemon threads run while the
...
interpreter is shutting down; instead, these threads are now killed when
they try to take the GIL.
2011-05-04 20:04:29 +02:00