| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a) --> PyTuple_New(0)
* Py_BuildValue("O", a) --> Py_INCREF(a)
|
|
|
|
|
| |
When parsing the constructor arguments failed, a
reference to the argument tuple was leaked.
|
|
|
|
| |
UnicodeTranslateError message.
|
|
|
|
|
| |
If there is only one bad character it will now be printed in a
form that is a valid Python string.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
__module__ is the string name of the module the function was defined
in, just like __module__ of classes. In some cases, particularly for
C functions, the __module__ may be None.
Change PyCFunction_New() from a function to a macro, but keep an
unused copy of the function around so that we don't change the binary
API.
Change pickle's save_global() to use whichmodule() if __module__ is
None, but add the __module__ logic to whichmodule() since it might be
used outside of pickle.
|
| |
|
|
|
|
|
| |
reported by Michael Hudson in
http://mail.python.org/pipermail/python-dev/2002-November/030299.html
|
|
|
|
|
|
|
| |
(Same problem as last checkin for SF bug 610610)
Need to clear the error and proceed.
Backport candidate
|
|
|
|
|
|
|
|
| |
The switch in Exception__str__ didn't clear the error if
PySequence_Size() raised an exception. Added a case -1 which clears
the error and falls through to the default case.
Definite backport candidate (this dates all the way to Python 2.0).
|
|
|
|
|
| |
missing key. (Also added a guard to SyntaxError__str__ to prevent
calling PyString_Check(NULL).)
|
|
|
|
|
| |
UnicodeTranslateError doesn't have an encoding attribute.
(Spotted by Neal Norwitz)
|
|
|
|
| |
to prevent buffer overflows (spotted by Neal Norwitz).
|
| |
|
|
|
|
|
| |
the future. Changed PEP 237 hex constant warnings from
DeprecationWarning to FutureWarning. Updated the documentation.
|
|
|
|
|
| |
also adds 'extern' to PyAPI_DATA rather than at each declaration, as
discussed with Tim and Guido.
|
| |
|
|
|
|
|
| |
that are in the process of deprecation (PendingDeprecationWarning).
Docs could be improved.
|
| |
|
|
|
|
|
|
| |
- recognize "SyntaxError"s by the print_file_and_line attribute.
- add the syntaxerror attributes to all exceptions in compile.c.
Fixes #221791
|
|
|
|
|
| |
Just being sure. The old code looks like it was safe, but there's no
harm in double-checking.
|
|
|
|
|
| |
are moving into the core; with these changes, it will be possible for the
exception to be raised without the weakref module ever being imported.
|
|
|
|
| |
are overflowing and a long int operation is substituted.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines
TODO:
documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)
|
| |
|
|
|
|
|
| |
location information for the SyntaxError -- do not do more than we
need to, stopping as soon as an exception has been raised.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
module__doc__: Document the Warning subclass heirarchy.
make_class(): Added a "goto finally" so that if populate_methods()
fails, the return status will be -1 (failure) instead of 0 (success).
fini_exceptions(): When decref'ing the static pointers to the
exception classes, clear out their dictionaries too. This breaks a
cycle from class->dict->method->class and allows the classes with
unbound methods to be reclaimed. This plugs a large memory leak in a
common Py_Initialize()/dosomething/Py_Finalize() loop.
|
|
|
|
| |
etc.).
|
|
|
|
|
|
| |
Changes to error messages to increase consistency & clarity.
This (mostly) closes SourceForge patch #101839.
|
| |
|
| |
|
|
|
|
|
|
|
| |
First, the allocated buffer was never freed after using it to create
the PyString object. Second, it was possible that have_filename would
be false (meaning that filename was not a PyString object), but that
the code would still try to PyString_GET_SIZE() it.
|
|
|
|
|
|
|
|
| |
returning a pointer to the start of the file's "base" name;
similar to os.path.basename().
SyntaxError__str__(): Use my_basename() to keep the length of the
file name included in the exception message short.
|
|
|
|
|
|
|
|
|
| |
than depending on the site that raises the exception. If the
filename and lineno attributes are set on the exception object,
use them to augment the message displayed.
This is part of what is needed to close SoruceForge bug #110628
(Jitterbug PR#278).
|
|
|
|
| |
the previous exceptions.py have WindowsError as a sub-class of OSError.
|
|
|
|
| |
('PyObject** x' -> 'PyObject **x')
|
|
|
|
|
|
|
|
|
|
| |
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").
There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
|
| |
|
| |
|
|
|
|
|
|
|
| |
used for indentation related errors. This patch includes Ping's
improvements for indentation-related error messages.
Closes SourceForge patches #100734 and #100856.
|
|
|
|
|
| |
variable. This crushes another memory leak. Slight rewrite
included.
|
|
|
|
|
|
|
|
| |
`break's. This first missing break caused a memory leak when case 3
fell through case 2 in the following example:
import os
os.chmod('/missing', 0600)
|
| |
|
|
|
|
| |
another typo caught by Rob Hooft
|
| |
|
|
|