| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
several extension methods and modules do not work without unicode support.
|
| |
|
|
|
|
| |
second line of code were not always recognized correctly.
|
|
|
|
|
| |
Fixes the tokenizer, tokenize.py and int() to reject this.
Patches by Malte Helmert.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Event alloc_fn: Called allocation function "metacompile" [model]
Event var_assign: Assigned variable "gr" to storage returned from "metacompile"
gr = metacompile(n);
Event pass_arg: Variable "gr" not freed or pointed-to in function "maketables" [model]
g = maketables(gr);
translatelabels(g);
addfirstsets(g);
Event leaked_storage: Returned without freeing storage "gr"
return g;
|
| |
|
| |
|
|
|
|
| |
is set.
|
|
|
|
|
|
| |
reported correctly.
Backquotes still don't report the correct file. The AST nodes only contain the line number but not the file name.
|
|
|
|
| |
The patches are adding deprecation warnings for back ticks and <>
|
|
|
|
| |
per discussion in issue 1031213.
|
|
|
|
| |
Also fix a memory leak.
|
|
|
|
| |
source encoding. Will backport to 2.5.
|
|
|
|
|
|
| |
* use %r instead of backticks since backticks are going away in Py3k
* PyArena_Malloc() already sets PyErr_NoMemory so we don't need to do it again
* the signature for ast2obj_int incorrectly used a bool, rather than a long
|
|
|
|
|
|
| |
is specified at the top of the file. Also add a note that Python/Python-ast.c
needs to be committed separately after a change to the AST grammar to capture
the revision number of the change (which is what __version__ is set to).
|
|
|
|
| |
definition.
|
|
|
|
| |
Will backport.
|
| |
|
|
|
|
|
| |
not being recognized as a keyword after, e.g., this statement:
from __future__ import division, with_statement
|
| |
|
|
|
|
| |
Klocwork 281
|
|
|
|
|
|
| |
There might be something else that needs to be done to setup the error.
Klocwork #295.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
|
| |
|
| |
|
|
|
|
| |
independently. Fixes #1355883.
|
| |
|
|
|
|
|
| |
entirely happy with the two new VISIT macros in compile.c, but I
couldn't see a better approach.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mismatches. At least I hope this fixes them all.
This reverts part of my change from yesterday that converted everything
in Parser/*.c to use PyObject_* API. The encoding doesn't really need
to use PyMem_*, however, it uses new_string() which must return PyMem_*
for handling the result of PyOS_Readline() which returns PyMem_* memory.
If there were 2 versions of new_string() one that returned PyMem_*
for tokens and one that return PyObject_* for encodings that could
also fix this problem. I'm not sure which version would be clearer.
This seems to fix both Guido's and Phillip's problems, so it's good enough
for now. After this change, it would be good to review Parser/*.c
for consistent use of the 2 memory APIs.
|
|
|
|
| |
Explicitly cast void* to int to cmpop_ty.
|
|
|
|
|
|
|
| |
malloc/realloc type functions, as well as renaming one variable called 'new'
in tokensizer.c. Still lots more to be done, going to be checking in one
chunk at a time or the patch will be massively huge. Still compiles ok with
gcc.
|
|
|
|
|
|
| |
This was the result of inconsistent use of PyMem_* and PyObject_* allocators.
By changing to use PyObject_* allocator almost everywhere, this removes
the inconsistency.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tracing/line number table in except blocks.
Reflow long lines introduced by col_offset changes. Update test_ast
to handle new fields in excepthandler.
As note in Python.asdl says, we might want to rethink how attributes
are handled. Perhaps they should be the same as other fields, with
the primary difference being how they are defined for all types within
a sum.
Also fix asdl_c so that constructors with int fields don't fail when
passed a zero value.
|
|
|
|
|
|
| |
* Cleanup formatting a bit (add spaces).
* Move static var initialized inside init_types() since that's the only place
it's used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
objimpl.h, pymem.h: Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE}
to PyObject_{Free, FREE} in a release build. They're aliases for the
system free() now.
_subprocess.c/sp_handle_dealloc(): Since the memory was originally
obtained via PyObject_NEW, it must be released via PyObject_FREE (or
_DEL).
pythonrun.c, tokenizer.c, parsermodule.c: I lost count of the number of
PyObject vs PyMem mismatches in these -- it's like the specific
function called at each site was picked at random, sometimes even with
memory obtained via PyMem getting released via PyObject. Changed most
to use PyObject uniformly, since the blobs allocated are predictably
small in most cases, and obmalloc is generally faster than system
mallocs then.
If extension modules in real life prove as sloppy as Python's front
end, we'll have to revert the objimpl.h + pymem.h part of this patch.
Note that no problems will show up in a debug build (all calls still go
thru obmalloc then). Problems will show up only in a release build, most
likely segfaults.
|
|
|
|
|
|
|
|
| |
This will hopefully get rid of some Coverity warnings, be a hint to
developers, and be marginally faster.
Some asserts were added when the type is currently known, but depends
on values from another function.
|
|
|
|
| |
(reviewed by Neal Norwitz)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
but without a specified encoding: decoding_fgets() (and decoding_feof()) can
return NULL and fiddle with the 'tok' struct, making tok->buf NULL. This is
okay in the other cases of calls to decoding_*(), it seems, but not in this
one.
This should get a test added, somewhere, but the testsuite doesn't seem to
test encoding anywhere (although plenty of tests use it.)
It seems to me that decoding errors in other places in the code (like at the
start of a token, instead of in the middle of one) make the code end up
adding small integers to NULL pointers, but happen to check for error states
before using the calculated new pointers. I haven't been able to trigger any
other crashes, in any case.
I would nominate this file for a comlete rewrite for Py3k. The whole
decoding trick is too bolted-on for my tastes.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
actually necessary for functionality, but good for transition.
|
| |
|
|
|
|
| |
Neal.
|
| |
|