Commit Graph

577 Commits

Author SHA1 Message Date
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
Victor Stinner 2fe9bac4dc Close #16742: Fix misuse of memory allocations in PyOS_Readline()
The GIL must be held to call PyMem_Malloc(), whereas PyOS_Readline() releases
the GIL to read input.

The result of the C callback PyOS_ReadlineFunctionPointer must now be a string
allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL if an error
occurred), instead of a string allocated by PyMem_Malloc() or PyMem_Realloc().

Fixing this issue was required to setup a hook on PyMem_Malloc(), for example
using the tracemalloc module.

PyOS_Readline() copies the result of PyOS_ReadlineFunctionPointer() into a new
buffer allocated by PyMem_Malloc(). So the public API of PyOS_Readline() does
not change.
2013-10-10 16:18:20 +02:00
Eli Bendersky 1891cff587 Move open outside try/finally 2013-09-26 09:35:39 -07:00
Eli Bendersky 99081238e9 Don't use fancy new Python features like 'with' - some bots don't have them
and can't bootstrap the parser.
2013-09-26 06:41:36 -07:00
Eli Bendersky 58fe1b1307 Normalize whitespace 2013-09-26 06:32:22 -07:00
Eli Bendersky b788a385cd Small fixes in Parser/asdl.py - no change in functionality.
1. Make it work when invoked directly from the command-line. It was failing
   due to a couple of stale function/class usages in the __main__ section.
2. Close the parsed file in the parse() function after opening it.
2013-09-26 06:31:32 -07:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Victor Stinner 14e461d5b9 Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Ezio Melotti d640fe2af5 #18803: merge with 3.3. 2013-08-26 01:33:30 +03:00
Ezio Melotti 7c4a7e6f3c #18803: fix more typos. Patch by Févry Thibault. 2013-08-26 01:32:56 +03:00
Antoine Pitrou 9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Christian Heimes 73207e03ad Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() fails. 2013-08-06 16:03:33 +02:00
Christian Heimes 9ae513caa7 Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() fails. 2013-08-06 15:59:16 +02:00
Christian Heimes 1289565f4b Silence warning about set but unused variable inside compile_atom() in non-debug builds 2013-07-31 23:48:04 +02:00
Christian Heimes 5e4d372524 Silence warning about set but unused variable inside compile_atom() in non-debug builds 2013-07-31 23:47:56 +02:00
Christian Heimes b7f1b38dea Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object(). 2013-07-27 00:33:35 +02:00
Christian Heimes 70c94e7896 Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object(). 2013-07-27 00:33:13 +02:00
Victor Stinner b318990cac (Merge 3.3) Parser/asdl_c.py: use Py_CLEAR() 2013-07-27 00:04:42 +02:00
Victor Stinner 1acc129d48 Parser/asdl_c.py: use Py_CLEAR() 2013-07-27 00:03:47 +02:00
Victor Stinner ee4b59c0f8 (Merge 3.3) According to the PEP 7, C code must "use 4-space indents"
Replace 8 spaces with 4.
2013-07-27 00:01:35 +02:00
Victor Stinner ce72e1ce6c According to the PEP 7, C code must "use 4-space indents"
Replace 8 spaces with 4.
2013-07-27 00:00:36 +02:00
Christian Heimes 7b3902a20f Some compilers complain about 'control reaches end of non-void function'
because they don't understand that Py_FatalError() terminates the program.
2013-07-22 16:34:28 +02:00
Christian Heimes 1eb0cb12ac Some compilers complain about 'control reaches end of non-void function'
because they don't understand that Py_FatalError() terminates the program.
2013-07-22 16:34:13 +02:00
Christian Heimes 826b754e32 Add sanity check to PyGrammar_LabelRepr() in order to catch invalid tokens when debugging
a new grammar.
CID 715360
2013-07-22 10:30:45 +02:00
Christian Heimes 53d2dc4045 Add sanity check to PyGrammar_LabelRepr() in order to catch invalid tokens when debugging
a new grammar.
CID 715360
2013-07-22 10:30:14 +02:00
Victor Stinner bdf630c4a7 Issue #18408: Fix Python-ast.c: handle init_types() failure (ex: MemoryError) 2013-07-17 00:17:15 +02:00
Benjamin Peterson cb2226cb69 merge 3.3 2013-07-15 20:50:25 -07:00
Benjamin Peterson 265fba40c8 move declaration to top of block 2013-07-15 20:50:22 -07:00
Benjamin Peterson fd9c0203de merge 3.3 (closes #18470) 2013-07-15 20:47:47 -07:00
Benjamin Peterson 2dbfd88245 check the return value of new_string() (closes #18470) 2013-07-15 19:15:34 -07:00
Victor Stinner 526daabf34 Issue #18408: parsetok() must not write into stderr on memory allocation error
The caller gets an error code and can raise a classic Python exception.
2013-07-11 23:17:33 +02:00
Victor Stinner 3bf5f530d9 Issue #18408: parsetok() must not write into stderr on memory allocation error
The caller gets an error code and can raise a classic Python exception.
2013-07-11 22:52:19 +02:00
Christian Heimes 22ed7fe906 Fix resource leak in parser, free node ptr
CID 1028068 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable n going out of scope leaks the storage it points to.
2013-06-29 21:03:51 +02:00
Serhiy Storchaka 9670543a00 Issue #18038: SyntaxError raised during compilation sources with illegal
encoding now always contains an encoding name.
2013-06-09 16:53:55 +03:00
Serhiy Storchaka 3af14aaba5 Issue #18038: SyntaxError raised during compilation sources with illegal
encoding now always contains an encoding name.
2013-06-09 16:51:52 +03:00
Victor Stinner 796977360f Issue #9566: Fix compiler warning on Windows 64-bit 2013-06-05 00:44:00 +02:00
Benjamin Peterson 8d89c2aaba change AST codegen to use PyModule_AddIntMacro 2013-05-20 10:28:48 -07:00
Benjamin Peterson 7654ab9ef0 placate msvc 2013-03-18 23:39:53 -07:00
Benjamin Peterson b72406b8fa refactor to fix refleaks 2013-03-18 23:24:41 -07:00
Benjamin Peterson cda75be02a unify some ast.argument's attrs; change Attribute column offset (closes #16795)
Patch from Sven Brauch.
2013-03-18 10:48:58 -07:00
Martin v. Löwis b26a9b10ea Replace WaitForSingleObject with WaitForSingleObjectEx,
for better WinRT compatibility.
2013-01-25 14:25:48 +01:00
Benjamin Peterson 442f20996d create NameConstant AST class for None, True, and False literals (closes #16619) 2012-12-06 17:41:04 -05:00
Mark Dickinson 073f067369 Issue #16546: merge fix from 3.3 2012-11-25 14:37:43 +00:00
Mark Dickinson ded35aeb9d Issue #16546: make ast.YieldFrom argument mandatory. 2012-11-25 14:36:26 +00:00
Benjamin Peterson 742b2f8d7a make PyGrammar_LabelRepr return a const char * (closes #16369) 2012-10-31 13:36:13 -04:00
Benjamin Peterson d0845588b8 make _PyParser_TokenNames const 2012-10-24 08:21:52 -07:00
Matthias Klose aee3c76acf - Issue #16262: fix out-of-src-tree builds, if mercurial is not installed. 2012-10-21 23:12:35 +02:00
Ezio Melotti 8a9cc526fe #15923: merge with 3.2. 2012-09-30 22:47:47 +03:00
Ezio Melotti cb2916a714 #15923: fix a mistake in asdl_c.py that resulted in a TypeError after 2801bf875a24 (see #15801). 2012-09-30 22:41:37 +03:00
Antoine Pitrou ca8aa4acf6 Issue #15144: Fix possible integer overflow when handling pointers as integer values, by using Py_uintptr_t instead of size_t.
Patch by Serhiy Storchaka.
2012-09-20 20:56:47 +02:00