| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
(patch provided by Greg Chapman)
|
|
|
|
|
|
|
|
|
| |
with an indented code block but no newline would raise SyntaxError.
This would have been a four-line change in parsetok.c... Except
codeop.py depends on this behavior, so a compilation flag had to be
invented that causes the tokenizer to revert to the old behavior;
this required extra changes to 2 .h files, 2 .c files, and 2 .py
files. (Fixes SF bug #501622.)
|
|
|
|
|
| |
instead of PyTuple_GetItem, so an overwritten __getitem__
in a tuple subclass works. SF bug #665835.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
object is not a real str or unicode but an instance
of a subclass, construct the output via looping
over __getitem__. This guarantees that the result
is the same for function==None and function==lambda x:x
This doesn't happen for tuples, because filtertuple()
uses PyTuple_GetItem().
(This was discussed on SF bug #665835).
|
|
|
|
|
| |
my MAL. Fixed. (Btw. eval() still doesn't take buffers, but that was so
even before my patch.)
|
|
|
|
| |
Incorporated nnorwitz's comment re. Py__USING_UNICODE.
|
|
|
|
| |
subclasses. (Discussed in SF patch #665835)
|
|
|
|
|
| |
so we can jump to the error handling code that does.
(Spotted by Neal Norwitz)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
blindly assumed that tp_as_sequence->sq_item always returns
a str or unicode object. This might fail with str or unicode
subclasses.
This patch checks whether the object returned from __getitem__
is a str/unicode object and raises a TypeError if not (and
the filter function returned true).
Furthermore the result for __getitem__ can be more than one
character long, so checks for enough memory have to be done.
|
| |
|
| |
|
|
|
|
| |
Clarify the operation of locals().
|
|
|
|
| |
Suggested by MvL.
|
|
|
|
|
|
|
| |
Obtain cleaner coding and a system wide
performance boost by using the fast, pre-parsed
PyArg_Unpack function instead of PyArg_ParseTuple
function which is driven by a format string.
|
|
|
|
|
|
|
|
|
|
|
| |
supported as the second argument. This has the same meaning as
for isinstance(), i.e. issubclass(X, (A, B)) is equivalent
to issubclass(X, A) or issubclass(X, B). Compared to isinstance(),
this patch does not search the tuple recursively for classes, i.e.
any entry in the tuple that is not a class, will result in a
TypeError.
This closes SF patch #649608.
|
| |
|
|
|
|
|
|
| |
simply PyErr_SetFromErrno
This closes bug 599163.
|
|
|
|
|
|
|
|
|
|
| |
- Use PyObject_Call() instead of PyEval_CallObject(), saves several
layers of calls and checks.
- Pre-allocate the argument tuple rather than calling Py_BuildValue()
each time round the loop.
- For filter(None, seq), avoid an INCREF and a DECREF.
|
| |
|
|
|
|
|
|
|
| |
u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.
Closes SF bug #593581.
|
|
|
|
| |
Rename all occurrences of MS_WIN32 to MS_WINDOWS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These built-in functions are replaced by their (now callable) type:
slice()
buffer()
and these types can also be called (but have no built-in named
function named after them)
classobj (type name used to be "class")
code
function
instance
instancemethod (type name used to be "instance method")
The module "new" has been replaced with a small backward compatibility
placeholder in Python.
A large portion of the patch simply removes the new module from
various platform-specific build recipes. The following binary Mac
project files still have references to it:
Mac/Build/PythonCore.mcp
Mac/Build/PythonStandSmall.mcp
Mac/Build/PythonStandalone.mcp
[I've tweaked the code layout and the doc strings here and there, and
added a comment to types.py about StringTypes vs. basestring. --Guido]
|
| |
|
|
|
|
|
| |
Also, added more regression tests to cover the new type and test its
conformity with range().
|
| |
|
|
|
|
|
|
|
| |
for 'str' and 'unicode', and can be used instead of
types.StringTypes, e.g. to test whether something is "a string":
isinstance(x, string) is True for Unicode and 8-bit strings. This
is an abstract base class and cannot be instantiated directly.
|
|
|
|
|
| |
NOT a bugfix candidate: this is a fix to an optimization introduced
in 2.3.
|
|
|
|
|
|
|
| |
and allocate it in one gulp.
This isn't a bugfix, it's just a minor optimization that may or may not
pay off.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
don't understand how this function works, also beefed up the docs. The
most common usage error is of this form (often spread out across gotos):
if (_PyString_Resize(&s, n) < 0) {
Py_DECREF(s);
s = NULL;
goto outtahere;
}
The error is that if _PyString_Resize runs out of memory, it automatically
decrefs the input string object s (which also deallocates it, since its
refcount must be 1 upon entry), and sets s to NULL. So if the "if"
branch ever triggers, it's an error to call Py_DECREF(s): s is already
NULL! A correct way to write the above is the simpler (and intended)
if (_PyString_Resize(&s, n) < 0)
goto outtahere;
Bugfix candidate.
|
|
|
|
|
| |
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
The argument can be an arbitrary iterable object.
|
|
|
|
|
|
|
|
| |
Highlights: import and friends will understand any of \r, \n and \r\n
as end of line. Python file input will do the same if you use mode 'U'.
Everything can be disabled by configuring with --without-universal-newlines.
See PEP278 for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PEP 285. Everything described in the PEP is here, and there is even
some documentation. I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison. I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.
Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
|
| |
|
|
|
|
|
| |
that it didn't tell enough of the truth.
Bugfix candidate (I guess -- it helps and it's harmless).
|
| |
|
|
|
|
|
|
|
|
| |
Based on the patch from Danny Yoo. The fix is in exec_statement() in
ceval.c.
There are also changes to introduce use of PyCode_GetNumFree() in
several places.
|
| |
|
|
|
|
| |
Changes enabling Python to compile under OS/2 Visual Age C++.
|
| |
|
| |
|
|
|
|
| |
masks any exception, not just AttributeError. Fix this.
|
|
|
|
|
| |
not other sequences (then we'd have to except strings, and we'd still
be susceptible to recursive attacks).
|
|
|
|
|
| |
builtin function); Guido pointed out that it could be just another
name in the __builtin__ dict for the file constructor now.
|
| |
|
|
|
|
| |
Preliminary support. What's here works, but needs fine-tuning.
|
| |
|
|
|
|
| |
found it necessary to warn about.
|
|
|
|
| |
__builtin__.dir(). Moved the guts from bltinmodule.c to object.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of PyMapping_Keys because we know we have a real dict. Tolerate that
objects may have an attr named "__dict__" that's not a dict (Py_None
popped up during testing).
test_descr.py, test_dir(): Test the new classic-class behavior; beef up
the new-style class test similarly.
test_pyclbr.py, checkModule(): dir(C) is no longer a synonym for
C.__dict__.keys() when C is a classic class (looks like the same thing
that burned distutils! -- should it be *made* a synoym again? Then it
would be inconsistent with new-style class behavior.).
|