summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Issue #26146: remove useless codeVictor Stinner2016-01-261-7/+0
| | | | | | | | obj2ast_constant() code is baesd on obj2ast_object() which has a special case for Py_None. But in practice, we don't need to have a special case for constants. Issue noticed by Joseph Jevnik on a review.
* Fix a refleak in validate_constant()Victor Stinner2016-01-261-0/+2
| | | | Issue #26146.
* Add ast.ConstantVictor Stinner2016-01-255-14/+181
| | | | | | | | | | | | | | | | | | | | | Issue #26146: Add a new kind of AST node: ast.Constant. It can be used by external AST optimizers, but the compiler does not emit directly such node. An optimizer can replace the following AST nodes with ast.Constant: * ast.NameConstant: None, False, True * ast.Num: int, float, complex * ast.Str: str * ast.Bytes: bytes * ast.Tuple if items are constants too: tuple * frozenset Update code to accept ast.Constant instead of ast.Num and/or ast.Str: * compiler * docstrings * ast.literal_eval() * Tools/parser/unparse.py
* Issue #26146: marshal.loads() now uses the empty frozenset singletonVictor Stinner2016-01-231-29/+40
|
* Issue #18018: Raise an ImportError if a relative import is attemptedBrett Cannon2016-01-231-3/+8
| | | | | | | | with no known parent package. Previously SystemError was raised if the parent package didn't exist (e.g., __package__ was set to ''). Thanks to Florent Xicluna and Yongzhi Pan for reporting the issue.
* Issue #25791: Warn when __package__ != __spec__.parent.Brett Cannon2016-01-222-93/+121
| | | | | | | | | In a previous change, __spec__.parent was prioritized over __package__. That is a backwards-compatibility break, but we do eventually want __spec__ to be the ground truth for module details. So this change reverts the change in semantics and instead raises an ImportWarning when __package__ != __spec__.parent to give people time to adjust to using spec objects.
* Use Py_uintptr_t for atomic pointersVictor Stinner2016-01-222-27/+28
| | | | | | | | Issue #26161: Use Py_uintptr_t instead of void* for atomic pointers in pyatomic.h. Use atomic_uintptr_t when <stdatomic.h> is used. Using void* causes compilation warnings depending on which implementation of atomic types is used.
* code_richcompare() now uses the constants typesVictor Stinner2016-01-221-48/+10
| | | | | | | | | Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now correctly compiled to two different functions: f1() returns 1 (int) and f2() returns 1.0 (int), even if 1 and 1.0 are equal. Add a new _PyCode_ConstantKey() private function.
* co_lnotab supports negative line number deltaVictor Stinner2016-01-203-135/+152
| | | | | | | | | | | | | | | | | | | | | Issue #26107: The format of the co_lnotab attribute of code objects changes to support negative line number delta. Changes: * assemble_lnotab(): if line number delta is less than -128 or greater than 127, emit multiple (offset_delta, lineno_delta) in co_lnotab * update functions decoding co_lnotab to use signed 8-bit integers - dis.findlinestarts() - PyCode_Addr2Line() - _PyCode_CheckLineNumber() - frame_setlineno() * update lnotab_notes.txt * increase importlib MAGIC_NUMBER to 3361 * document the change in What's New in Python 3.6 * cleanup also PyCode_Optimize() to use better variable names
* Merge 3.5Victor Stinner2016-01-203-21/+22
|\ | | | | | | Issue #26154: Add a new private _PyThreadState_UncheckedGet() function.
| * Add _PyThreadState_UncheckedGet()Victor Stinner2016-01-203-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which gets the current thread state, but don't call Py_FatalError() if it is NULL. Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to no more expose complex and private atomic types. Atomic types depends on the compiler or can even depend on compiler options. The new function _PyThreadState_UncheckedGet() allows to get the variable value without having to care of the exact implementation of atomic types. Changes: * Replace direct usage of the _PyThreadState_Current variable with a call to _PyThreadState_UncheckedGet(). * In pystate.c, replace direct usage of the _PyThreadState_Current variable with the PyThreadState_GET() macro for readability. * Document also PyThreadState_Get() in pystate.h
* | Fix indentation of continuation lines.Georg Brandl2016-01-181-1/+1
| |
* | Fix two instances of wrong indentation.Georg Brandl2016-01-181-2/+2
| |
* | Issue #25791: Raise an ImportWarning when __spec__ or __package__ areBrett Cannon2016-01-152-294/+329
| | | | | | | | | | | | | | | | not defined for a relative import. This is the start of work to try and clean up import semantics to rely more on a module's spec than on the myriad attributes that get set on a module. Thanks to Rose Ames for the patch.
* | Issue #20440: Cleaning up the code by using Py_SETREF.Serhiy Storchaka2016-01-053-14/+5
| |
* | merge 3.5Benjamin Peterson2016-01-011-1/+1
|\ \ | |/
| * merge 3.4Benjamin Peterson2016-01-011-1/+1
| |\
| | * merge 3.3Benjamin Peterson2016-01-011-1/+1
| | |\
| | | * 2016 will be another year of writing copyrighted codeBenjamin Peterson2016-01-011-1/+1
| | | |
* | | | merge 3.5 (#25973)Benjamin Peterson2015-12-291-8/+16
|\ \ \ \ | |/ / /
| * | | make recording and reporting errors and nonlocal and global directives more ↵Benjamin Peterson2015-12-291-8/+16
| | | | | | | | | | | | | | | | robust (closes #25973)
* | | | Issue #25802: Deprecate load_module() on ↵Brett Cannon2015-12-291-1516/+1517
| | | | | | | | | | | | | | | | | | | | | | | | | | | | importlib.machinery.SourceFileLoader and SourcelessFileLoader. They were the only remaining implementations of load_module() not documented as deprecated.
* | | | Issue #20440: More use of Py_SETREF.Serhiy Storchaka2015-12-272-15/+8
|\ \ \ \ | |/ / / | | | | | | | | | | | | This patch is manually crafted and contains changes that couldn't be handled automatically.
| * | | Issue #20440: More use of Py_SETREF.Serhiy Storchaka2015-12-271-8/+5
| | | | | | | | | | | | | | | | | | | | This patch is manually crafted and contains changes that couldn't be handled automatically.
* | | | Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-3/+1
|\ \ \ \ | |/ / / | | | | | | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
| * | | Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-3/+1
| | | | | | | | | | | | | | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
* | | | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-2510-60/+62
| | | | | | | | | | | | | | | | private functions.
* | | | Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-259-21/+24
| | | |
* | | | Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-243-8/+4
|\ \ \ \ | |/ / / | | | | | | | | macro Py_SETREF.
| * | | Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-243-8/+4
| | | | | | | | | | | | | | | | macro Py_SETREF.
* | | | Issue #25899: Converted non-ASCII characters in docstrings and manpageSerhiy Storchaka2015-12-181-2/+2
|\ \ \ \ | |/ / / | | | | | | | | | | | | to ASCII replacements. Removed UTF-8 BOM from Misc/NEWS. Original patch by Chris Angelico.
| * | | Issue #25899: Converted non-ASCII characters in docstrings and manpageSerhiy Storchaka2015-12-181-2/+2
| | | | | | | | | | | | | | | | to ASCII replacements. Original patch by Chris Angelico.
* | | | Merge typo fixes from 3.5Martin Panter2015-12-171-2/+2
|\ \ \ \ | |/ / /
| * | | Fix a couple of typos in code commentsMartin Panter2015-12-171-2/+2
| | | |
* | | | Issue #5319: New Py_FinalizeEx() API to exit with status 120 on failureMartin Panter2015-11-303-17/+41
| | | |
* | | | Issue #25557: Refactor _PyDict_LoadGlobal()Victor Stinner2015-11-201-2/+9
| | | | | | | | | | | | | | | | | | | | Don't fallback to PyDict_GetItemWithError() if the hash is unknown: compute the hash instead. Add also comments to explain the optimization a little bit.
* | | | Merge 3.5 (pytime)Victor Stinner2015-11-101-3/+3
|\ \ \ \ | |/ / /
| * | | pytime.c: rename pygettimeofday_new() to pygettimeofday()Victor Stinner2015-11-101-3/+3
| | | | | | | | | | | | | | | | I forgot to rename it in my previous refactoring of pytime.c.
| * | | Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node whenVictor Stinner2015-11-062-8/+32
| | | | | | | | | | | | | | | | compiling AST from Python objects.
* | | | Issue #25558: Use compile-time asserts.Serhiy Storchaka2015-11-072-14/+13
| | | |
* | | | Issue #24802: Merge null termination fixes from 3.5Martin Panter2015-11-071-16/+32
|\ \ \ \ | |/ / /
| * | | Issue #24802: Merge null termination fixes from 3.4 into 3.5Martin Panter2015-11-071-16/+32
| |\ \ \ | | |/ /
| | * | Issue #24802: Copy bytes-like objects to null-terminated buffers if necessaryMartin Panter2015-11-071-16/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids possible buffer overreads when int(), float(), compile(), exec() and eval() are passed bytes-like objects. Similar code is removed from the complex() constructor, where it was not reachable. Patch by John Leitch, Serhiy Storchaka and Martin Panter.
* | | | Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node whenVictor Stinner2015-11-062-8/+32
| | | | | | | | | | | | | | | | compiling AST from Python objects.
* | | | Reuse Py_STRINGIFY() macro in sre_lib.h and dynload_win.c.Serhiy Storchaka2015-11-051-4/+2
| | | |
* | | | Issue #25556: Add assertions to PyObject_GetItem() to ensure that an exceptionVictor Stinner2015-11-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is raised when it returns NULL. Simplify also ceval.c: rely on the fact that PyObject_GetItem() raised an exception when it returns NULL.
* | | | Merge 3.5Victor Stinner2015-11-051-0/+4
|\ \ \ \ | |/ / /
| * | | Issue #25556: Fix LOAD_GLOBAL bytecode when globals type is not dict and theVictor Stinner2015-11-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | requested name doesn't exist in globals: clear the KeyError exception before calling PyObject_GetItem(). Fail also if the raised exception is not a KeyError.
* | | | sysmodule.c: reuse Py_STRINGIFY() macroVictor Stinner2015-11-051-6/+2
| | | |
* | | | Issue 25483: Add an opcode to make f-string formatting more robust.Eric V. Smith2015-11-034-169/+194
| | | |