Christian Heimes
985ecdcfc2
ssue #19183 : Implement PEP 456 'secure and interchangeable hash algorithm'.
...
Python now uses SipHash24 on all major platforms.
2013-11-20 11:46:18 +01:00
Victor Stinner
f8e3221fa5
Issue #9566 , #19617 : Fix more compiler warnings in compile.c on Windows 64-bit
2013-11-19 23:56:34 +01:00
Victor Stinner
85fe8a645e
Issue #9566 , #19617 : New try to fix compilation on Windows
...
Some compilers (ex: Visual Studio) decode -2147483648 as a unsigned integer
instead of an signed integer.
2013-11-19 23:03:25 +01:00
Victor Stinner
b679a2eb78
Issue #9566 , #19617 : Fix compilation on Windows
...
INT32_MIN and INT32_MAX constants are unknown on Windows.
2013-11-19 22:28:01 +01:00
Victor Stinner
ad9a066050
Issue #9566 : compile.c uses Py_ssize_t instead of int to store sizes to fix
...
compiler warnings on Windows 64-bit. Use Py_SAFE_DOWNCAST() where the final
downcast is needed.
The bytecode doesn't support integer parameters larger than 32-bit yet.
2013-11-19 22:23:20 +01:00
Victor Stinner
4a58707a34
Add _PyUnicodeWriter_WriteASCIIString() function
2013-11-19 12:54:53 +01:00
Serhiy Storchaka
58cf607d13
Issue #12892 : The utf-16* and utf-32* codecs now reject (lone) surrogates.
...
The utf-16* and utf-32* encoders no longer allow surrogate code points
(U+D800-U+DFFF) to be encoded.
The utf-32* decoders no longer decode byte sequences that correspond to
surrogate code points.
The surrogatepass error handler now works with the utf-16* and utf-32* codecs.
Based on patches by Victor Stinner and Kang-Hao (Kenny) Lu.
2013-11-19 11:32:41 +02:00
Victor Stinner
cb29ec5f74
PY_FORMAT_SIZE_T should not be used with PyErr_Format(), PyErr_Format("%zd") is
...
portable
2013-11-18 02:05:31 +01:00
Victor Stinner
74387f5cac
Use Py_ssize_t type for sizes in getargs.c
...
Fix compiler warnings on Windows 64-bit
2013-11-18 01:21:12 +01:00
Victor Stinner
b11d6cb711
fileutils.c: use MAXPATHLEN instead of PATH_MAX
...
PATH_MAX is not declared on IRIX nor Windows.
2013-11-15 18:14:11 +01:00
Victor Stinner
2384714819
sysmodule.c: fix sys_update_path(), use Py_ARRAY_LENGTH() to get the size of
...
the fullpath buffer, not PATH_MAX. fullpath is declared using MAXPATHLEN or
MAX_PATH depending on the OS, and PATH_MAX is not declared on IRIX.
2013-11-15 17:33:43 +01:00
Victor Stinner
2f5bbc6a12
pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get the size of
...
the env_home buffer, not PATH_MAX+1. env_home is declared using MAXPATHLEN+1,
and PATH_MAX is not declared on IRIX.
2013-11-15 17:09:24 +01:00
Victor Stinner
da062558db
Fix compiler warning (on Windows 64-bit): explicit cast Py_ssize_t to unsigned
...
char, n is in range [0; 255] (a tuple cannot have a negative length)
2013-11-16 00:13:29 +01:00
Victor Stinner
0c083461a5
Fix compiler warning in win32_urandom(): explicit cast to DWORD in
...
CryptGenRandom()
2013-11-15 23:26:25 +01:00
Victor Stinner
c31ebb60f9
(Merge 3.3) fileutils.c: use MAXPATHLEN instead of PATH_MAX
...
PATH_MAX is not declared on IRIX nor Windows.
2013-11-15 18:14:33 +01:00
Victor Stinner
50e0157013
(Merge 3.3) sysmodule.c: fix sys_update_path(), use Py_ARRAY_LENGTH() to get
...
the size of the fullpath buffer, not PATH_MAX. fullpath is declared using
MAXPATHLEN or MAX_PATH depending on the OS, and PATH_MAX is not declared on
IRIX.
2013-11-15 17:35:31 +01:00
Victor Stinner
b5a7a0aa3f
(Merge 3.3) pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get
...
the size of the env_home buffer, not PATH_MAX+1. env_home is declared using
MAXPATHLEN+1, and PATH_MAX is not declared on IRIX.
2013-11-15 17:12:14 +01:00
Nick Coghlan
c4c2580d43
Close 19609: narrow scope of codec exc chaining
2013-11-15 21:47:37 +10:00
Victor Stinner
5eb4f59cd9
Issue #19437 : Fix init_builtin(), handle _PyImport_FindExtensionObject()
...
failure
2013-11-14 22:38:52 +01:00
Stefan Krah
49d0479357
Add unused third arg for the benefit of Valgrind.
2013-11-14 15:35:47 +01:00
Victor Stinner
c82729e44f
Issue #19437 : Fix fold_unaryops_on_constants() of the peephole optimizer, clear
...
the exception when PyList_Append() fails
2013-11-14 01:21:00 +01:00
Nick Coghlan
8b097b4ed7
Close #17828 : better handling of codec errors
...
- output type errors now redirect users to the type-neutral
convenience functions in the codecs module
- stateless errors that occur during encoding and decoding
will now be automatically wrapped in exceptions that give
the name of the codec involved
2013-11-13 23:49:21 +10:00
Victor Stinner
22af2599a9
Issue #19437 : Fix PyImport_ImportModuleLevelObject(), handle
...
PyUnicode_Substring() failure (ex: MemoryError)
2013-11-13 12:11:36 +01:00
Victor Stinner
3f36a5736b
Issue #19515 : Remove identifiers duplicated in the same file.
...
Patch written by Andrei Dorian Duma.
2013-11-12 21:39:02 +01:00
Victor Stinner
dcf17f8a55
Issue #19466 : Fix typo. Patch written by Vajrasky Kok.
2013-11-12 17:18:51 +01:00
Victor Stinner
45956b9a33
Close #19466 : Clear the frames of daemon threads earlier during the Python
...
shutdown to call objects destructors. So "unclosed file" resource warnings are
now corretly emitted for daemon threads.
2013-11-12 16:37:55 +01:00
Victor Stinner
bd303c165b
Issue #19512 , #19515 : remove shared identifiers, move identifiers where they
...
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner
efa7a0e155
print_error_text() doesn't encode the filename anymore
...
Use aslo PyUnicode_FromFormat() to format the line so only one call to
PyFile_WriteObject() is needed. tb_displayline() of Python/traceback.c has
similar implementation.
2013-11-07 12:37:56 +01:00
Victor Stinner
79ed4c744a
remove an outdated comment
...
The comment is meaningless since changeset 4e985a96a612.
2013-11-07 00:53:56 +01:00
Victor Stinner
53e9ec48e5
Issue #19512 : Use the new _PyId_builtins identifier
2013-11-07 00:43:05 +01:00
Victor Stinner
ad14ccd047
Issue #19512 : add _PyUnicode_CompareWithId() function
...
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.
Add also _PyId_builtins identifier for "builtins" common string.
2013-11-07 00:46:04 +01:00
Victor Stinner
937114f704
print_exception(): don't encode the module name to UTF-8
...
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
2013-11-07 00:12:30 +01:00
Victor Stinner
eaa2883d15
Issue #19512 : builtin print() function uses an identifier instead of literal
...
string "flush" to call the flush method
2013-11-07 00:01:51 +01:00
Victor Stinner
ae9f161b43
Issue #19512 : __build_class() builtin now uses an identifier for the "metaclass" string
2013-11-06 22:46:51 +01:00
Victor Stinner
090543736f
Issue #19512 : add some common identifiers to only create common strings once,
...
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner
cab75e3e1e
Issue #19512 : PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
...
to only create the "displayhook" string once
2013-11-06 22:38:37 +01:00
Victor Stinner
d67bd45537
Issue #19512 : Add _PySys_GetObjectId() and _PySys_SetObjectId() functions
2013-11-06 22:36:40 +01:00
Victor Stinner
b44562b6b9
Issue #19512 : eval() and exec() now use an identifier for "__builtins__" string
2013-11-06 19:03:11 +01:00
Victor Stinner
95701bdf40
Issue #19512 : Add PyRun_InteractiveOneObject() function
...
Only decode the filename once. PyRun_InteractiveOneObject() uses an identifier
for "<string>" string, so the byte string is only decoded once.
2013-11-06 18:41:07 +01:00
Victor Stinner
4ee41c5839
Issue #19512 : _print_total_refs() now uses an identifier to get "showrefcount"
...
key from sys._xoptions
2013-11-06 18:28:21 +01:00
Victor Stinner
d02fbb8f71
Issue #19512 : sys_displayhook() now uses an identifier for "builtins"
...
dictionary key and only decodes "\n" string once to write a newline.
So "builtins" and "\n" are only decoded once from UTF-8, at the first call.
2013-11-06 18:27:13 +01:00
Victor Stinner
98e818b8e3
Issue #19437 : Fix compiler_class(), handle compiler_lookup_arg() failure
2013-11-05 18:07:34 +01:00
Brett Cannon
2b8fc303ad
Abstract out stat calls in importlib for easier experimentation.
2013-11-01 14:04:24 -04:00
Brett Cannon
f6901c8baa
Issue #19410 : Put back in special-casing of '' for
...
importlib.machinery.FileFinder.
While originally moved to stop special-casing '' as PathFinder farther
up the typical call chain now uses the cwd in the instance of '', it
was deemed an unnecessary risk to breaking subclasses of FileFinder to
take the special-casing out.
2013-11-01 10:37:57 -04:00
Eric Snow
cdf601281f
Issue #19413 : Restore pre-3.3 reload() semantics of re-finding modules.
2013-10-31 22:22:15 -06:00
Victor Stinner
dcdd05b0b4
Close #19442 : warn_explicit() does nothing when called late during Python shutdown
...
After more tests, I now think that it is the safest option.
2013-11-01 00:55:30 +01:00
Victor Stinner
359fabc19f
Issue #19437 : Cleanup r_ref() of the marshal module
2013-10-31 17:09:01 +01:00
Victor Stinner
d5cae6f143
Issue #19437 : Fix r_object() of marshal module, handle PyDict_SetItem() failure
...
for TYPE_DICT and stop immedialty on first r_object() failure
2013-10-31 17:14:52 +01:00
Victor Stinner
b1b7b1834b
Issue #19437 : Fix r_object() of marshal module, handle r_byte() failure for
...
TYPE_SMALL_TUPLE
2013-10-31 17:07:08 +01:00
Victor Stinner
763b0d19c9
Issue #19437 : Fix r_PyLong() of marshal module, stop immediatly at first
...
failure, don't read any more data
2013-10-31 16:56:38 +01:00
Victor Stinner
ae233eab5c
Issue #19437 : Fix show_warning() of _warnings, stop at the first error to not
...
call a Python function with an exception set
2013-10-31 14:51:38 +01:00
Victor Stinner
3cd04aa1b2
Issue #19437 : Fix get_filter() from _warnings, don't call PyObject_IsSubclass()
...
with an exception set
2013-10-31 14:46:00 +01:00
Benjamin Peterson
472805df59
merge 3.3
2013-10-31 01:21:06 -04:00
Benjamin Peterson
7f69dcac16
make string literal const
2013-10-31 01:20:58 -04:00
Benjamin Peterson
96c03df771
merge 3.3
2013-10-29 22:25:55 -04:00
Benjamin Peterson
8f169489c4
update comment
2013-10-29 22:25:06 -04:00
Victor Stinner
856f45f09c
Issue #19442 : Fix warnings emitted during Python shutdown
...
Warnings may be emitted during Python shutdown, like "unclosed file XXX".
During shutdown, globals()['__main__'] may be None.
2013-10-30 00:04:59 +01:00
Victor Stinner
a4c704b260
Issue #19424 : Fix the warnings module to accept filename containing surrogate
...
characters.
2013-10-29 23:43:41 +01:00
Victor Stinner
41bb43a71e
Issue #18408 : Add a new PyFrame_FastToLocalsWithError() function to handle
...
exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.
2013-10-29 01:19:37 +01:00
Victor Stinner
ce5f4fba11
Issue #19421 : fix a check in warnings.warn() to be able to use it during Python
...
finalization.
sys.argv is set to None during Python finalization: add PyList_Check() to avoid
a crash in PyList_Size().
2013-10-28 18:47:22 +01:00
Victor Stinner
8fea252a50
Issue #18520 : fix reference leak in _PySys_Init()
2013-10-27 17:15:42 +01:00
Christian Heimes
efa48676d5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
...
Python executable and not removed by the linker's optimizer.
2013-10-22 10:23:12 +02:00
Christian Heimes
49e61806f5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
...
Python executable and not removed by the linker's optimizer.
2013-10-22 10:22:29 +02:00
Guido van Rossum
7be5d7d0e0
Issue 19306: Add extra hints to faulthandler stack dumps that they are upside down.
2013-10-20 18:21:02 -07:00
Benjamin Peterson
6b4f7803f8
cleanup the construction of __qualname__ ( closes #19301 again)
2013-10-20 17:50:28 -04:00
Nick Coghlan
6de9200e57
Close #19313 : remove no longer needed Py_XINCREF
...
Eliminates a refleak introduced in commit b4a325275fb0
2013-10-20 22:43:53 +10:00
Benjamin Peterson
34d33a595b
removal u_qualname, since compiler_scope_qualname is only ever called once
2013-10-19 16:15:58 -04:00
Benjamin Peterson
a8a38b8e4f
strengthen condition and add assertion
2013-10-19 16:14:39 -04:00
Benjamin Peterson
3d9e481ece
give explicitly global functions and classes a global __qualname__ ( closes #19301 )
2013-10-19 16:01:13 -04:00
Serhiy Storchaka
c679227e31
Issue #1772673 : The type of `char*` arguments now changed to `const char*`.
2013-10-19 21:03:34 +03:00
Brett Cannon
58f5680462
Issue #18810 : Be optimistic with stat calls when seeing if a directory
...
exists when checking for a package.
Before there was an isdir check and then various isfile checks for
possible __init__ files when looking for a package.
This change drops the isdir check by leaning
on the assumption that a directory will not contain something named
after the module being imported which is not a directory. If the module
is a package then it saves a stat call. If there is nothing in the
directory with the potential package name it also saves a stat call.
Only if there is something in the directory named the same thing as
the potential package will the number of stat calls increase
(due to more wasteful __init__ checks).
Semantically there is no change as the isdir check moved
down so that namespace packages continue to have no chance of
accidentally collecting non-existent directories.
2013-10-18 13:24:13 -04:00
Brett Cannon
bb9e481efa
Issue #18416 : Fix various os calls in importlib.machinery.FileFinder
...
now that self.path is no longer forced to '.'.
2013-10-18 12:01:06 -04:00
Brett Cannon
27e27f7ee1
Issue #18416 : Have importlib.machinery.PathFinder treat '' as the cwd
...
and stop importlib.machinery.FileFinder treating '' as '.'.
Previous PathFinder transformed '' into '.' which led to __file__ for
modules imported from the cwd to always be relative paths. This meant
the values of the attribute were wrong as soon as the cwd changed.
This change now means that as long as the site module is run (which
makes all entries in sys.path absolute) then all values for __file__
will also be absolute unless it's for __main__ when specified by file
path in a relative way (modules imported by runpy will have an
absolute path).
Now that PathFinder is no longer treating '' as '.' it only makes
sense for FileFinder to stop doing so as well. Now no transformation
is performed for the directory given to the __init__ method.
Thanks to Madison May for the initial patch.
2013-10-18 11:39:04 -04:00
Nick Coghlan
1805a62f1f
Issue #16129 : Py_SetStandardStreamEncoding cleanups
...
- don't call PyErr_NoMemory with interpreter is not initialised
- note that it's OK to call _PyMem_RawStrDup here
- don't include this in the limited API
- capitalise "IO"
- be explicit that a non-zero return indicates an error
- include versionadded marker in docs
2013-10-18 23:11:47 +10:00
Nick Coghlan
7d270ee05d
Issue #16129 : Add `Py_SetStandardStreamEncoding`
...
This new pre-initialization API allows embedding
applications like Blender to force a particular
encoding and error handler for the standard IO streams.
Also refactors Modules/_testembed.c to let us start
testing multiple embedding scenarios.
(Initial patch by Bastien Montagne)
2013-10-17 22:35:35 +10:00
Antoine Pitrou
42c25f5581
Close #19260 : remove outdated comment in marshal.c
2013-10-14 20:50:32 +02:00
Georg Brandl
142ad666dc
Re #18521 : move array bounds check before array access.
2013-10-14 07:01:11 +02:00
Georg Brandl
6083a4bc1c
Re #18521 : remove assignments of variables that are immediately reassigned.
2013-10-14 06:51:46 +02:00
Antoine Pitrou
6039db8de3
Issue #18776 : atexit callbacks now display their full traceback when they raise an exception.
2013-10-13 21:54:15 +02:00
Antoine Pitrou
24201d497c
Issue #18776 : atexit callbacks now display their full traceback when they raise an exception.
2013-10-13 21:53:13 +02:00
Kristján Valur Jónsson
0a7697b718
Catch a few extra error cases in marshal.c
2013-10-13 15:19:56 +00:00
Kristján Valur Jónsson
5983258bf2
Issue #19219 Remove a lot of "retval = NULL" statements, now that retval
...
is pre-initialized to that value. Test show a 5% speedup as a bonus.
2013-10-13 13:41:59 +00:00
Christian Heimes
3572842c19
Issue #19219 : retval may be used uninitialized value
...
CID 486239: Uninitialized pointer read (UNINIT)
2013-10-13 02:29:06 +02:00
Antoine Pitrou
b30f271299
Try to fix weird assertion error on the Fedora buildbot.
2013-10-12 23:14:47 +02:00
Antoine Pitrou
d01d396e7f
Issue #4555 : All exported C symbols are now prefixed with either "Py" or "_Py".
...
("make smelly" now clean)
2013-10-12 22:52:43 +02:00
Antoine Pitrou
409b53840b
Don't export internal symbols ("make smelly")
2013-10-12 22:41:17 +02:00
Antoine Pitrou
1164dfcb86
Issue #19219 : Speed up marshal.loads(), and make pyc files slightly (5% to 10%) smaller.
2013-10-12 22:25:39 +02:00
Victor Stinner
8d19767403
Close #19199 : Remove ``PyThreadState.tick_counter`` field
2013-10-09 14:53:01 +02:00
Antoine Pitrou
1cfa0ba883
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
2013-10-07 20:40:59 +02:00
Antoine Pitrou
59c900d3bf
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
2013-10-07 20:38:51 +02:00
Georg Brandl
af1edb7f45
merge with 3.3
2013-10-06 18:48:30 +02:00
Georg Brandl
c6a2c9b466
Closes #15213 : update comment for _PyOS_URandom
2013-10-06 18:43:19 +02:00
Eric Snow
5c4b4c530f
[issue19152] Revert 832579dbafd6.
2013-10-03 15:03:29 -06:00
Eric Snow
af8566c847
[issue19152] Add ExtensionFileLoader.get_filename().
2013-10-03 12:08:55 -06:00
Eric Snow
5179445520
[issue19152] Add ExtensionFileLoader.get_filename().
2013-10-03 12:08:55 -06:00
Eric Snow
efbc475278
[issue19151] Fix docstring and use of _get_suppported_file_loaders() to reflect 2-tuples.
2013-10-03 12:08:55 -06:00
Eric Snow
e8bbfebee0
[issue19951] Fix docstring and use of _get_suppported_file_loaders() to reflect 2-tuples.
2013-10-03 12:08:55 -06:00
Benjamin Peterson
c30d05855a
merge 3.3 ( #19098 )
2013-09-26 22:21:41 -04:00
Benjamin Peterson
305e5aac85
don't scale compiler stack frames if the recursion limit is huge ( closes #19098 )
2013-09-26 22:17:45 -04:00
Serhiy Storchaka
bf28d2dcad
Issue #18818 : The "encodingname" part of PYTHONIOENCODING is now optional.
2013-09-13 11:46:24 +03:00