| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
though this should not be able to happen since we already parsed the args)
|
| | |
|
| |
|
|
|
|
| |
be NULL so assert it. Fix one place where we could have passed NULL.
Reported by Klocwork #66.
|
| |
|
|
| |
Reported by Klocwork #67
|
| |
|
|
| |
to test for the C compiler version when determining if we have the secure CRT from microsoft. Must test with an undocumented macro, __STDC_SECURE_LIB__ too.
|
| |
|
|
|
|
| |
CRT error handler and disable the assertion for debug builds. This causes CRT to set errno to EINVAL.
This update fixes crash cases in the test suite where the default CRT error handler would cause process exit.
|
| |
|
|
|
|
| |
- update header checks, using autoconf
- provide dummies for getenv, environ, and GetVersion
- adjust MSC_VER check in socketmodule.c
|
| |
|
|
| |
latter can return something that's true.
|
| |
|
|
|
| |
strings and removes a possible "U" before passing the mode to the
C library function.
|
| |
|
|
|
|
|
|
| |
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
|
| | |
|
| |
|
|
| |
are concerned.
|
| |
|
|
|
| |
using a C++ compiler. Still lots and lots of errors in the modules built by
setup.py, and a bunch of warnings from g++ in the core.
|
| |
|
|
|
|
|
|
|
| |
PyTypeObject structures, I had to make prototypes for the functions, and
move the structure definition ahead of the functions. I'd dearly like a better
way to do this - to change this would make for a massive set of changes to
the codebase.
There's still some warnings - this is purely to get rid of errors first.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Anyway, this is the changes to the with-statement
so that __exit__ must return a true value in order
for a pending exception to be ignored.
The PEP (343) is already updated.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- New semantics for __exit__() -- it must re-raise the exception
if type is not None; the with-statement itself doesn't do this.
(See the updated PEP for motivation.)
- Added context managers to:
- file
- thread.LockType
- threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
- decimal.Context
- Added contextlib.py, which defines @contextmanager, nested(), closing().
- Unit tests all around; bot no docs yet.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
readline/readlines/read/readinto, loudly break by raising ValueError, rather
than silently deliver data out of order or hitting EOF prematurely.
Probably not a bugfix candidate, even though it affects no 'working' code.
|
| | |
|
| |
|
|
|
| |
(calling ftell(stdin) doesn't seem defined). So we won't test errors
from ftell unless we can do it portably.
|
| |
|
|
|
| |
ftell(3) on BSD doesn't set errno even for ttys and returns useless
values.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In C++, it's an error to pass a string literal to a char* function
without a const_cast(). Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.
I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc. Predictably, there were a large set of functions that
needed to be fixed as a result of these changes. The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].
One cast was required as a result of the changes: A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
|
| |
|
|
| |
278. Closes bug 967182.
|
| |
|
|
|
| |
stderr. close() can fail if the user is out-of-quota, for example.
Fixes #959379.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
close() calls would attempt to free() the buffer already free()ed on
the first close(). [bug introduced with patch #788249]
Making sure that the buffer is free()ed in file object deallocation is
a belt-n-braces bit of insurance against a memory leak.
|
| |
|
|
| |
Fixes SF Bug #773356
|
| |
|
|
| |
Py_USING_UNICODE is defined
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
* 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)
|
| |
|
|
| |
Will backport to 2.2.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
file_truncate(): C doesn't define what fflush(fp) does if fp is open
for update, and the preceding I/O operation on fp was input. On Windows,
fflush() actually changes the current file position then. Because
Windows doesn't support ftruncate() directly, this not only caused
Python's file.truncate() to change the file position (contra our docs),
it also caused the file not to change size.
Repaired by getting the initial file position at the start, restoring
it at the end, and tossing all the complicated micro-efficiency checks
trying to avoid "provably unnecessary" seeks. file.truncate() can't
be a frequent operation, and seeking to the current file position has
got to be cheap anyway.
Bugfix candidate.
|
| |
|
|
| |
Fixes #603724. Will backport to 2.3.
|
| |
|
|
| |
If opening a directory, the exception would leak.
|
| | |
|
| |
|
|
| |
the terminal encoding on Windows and Unix.
|
| |
|
|
| |
only. Repaired, and added new tests to test_file.py.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
(file_read): Replaced assertion with mixed sign operation by a simple
comment (thank you Raymond). The algorithm is clear enough in that point.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[#521782] unreliable file.read() error handling
* Objects/fileobject.c
(file_read): Clear errors before leaving the loop in all situations,
and also check if some data was read before exiting the loop with an
EWOULDBLOCK exception.
* Doc/lib/libstdtypes.tex
* Objects/fileobject.c
Document that sometimes a read() operation can return less data than
what the user asked, if running in non-blocking mode.
* Misc/NEWS
Document the fix.
|
| | |
|
| | |
|