- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error
if methods have annotations; it now correctly displays the annotations.
+- Issue #18600: Added policy argument to email.message.Message.as_string,
+ and as_bytes and __bytes__ methods to Message.
+
+- Issue #18671: Output more information when logging exceptions occur.
+
+- Issue #18621: Prevent the site module's patched builtins from keeping
+ too many references alive for too long.
+
+- Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert.
+
+- Issue #8860: Fixed rounding in timedelta constructor.
+
+Tests
+-----
+
+- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as
+ possible, since "localhost" goes through a DNS lookup under recent Windows
+ versions.
+
++Documentation
++-------------
++
++- Issue #18783: Removed existing mentions of Python long type in docstrings,
++ error messages and comments.
++
+
+What's New in Python 3.4.0 Alpha 1?
+===================================
+
+Release date: 2013-08-03
+
+Core and Builtins
+-----------------
+
+- Issue #16741: Fix an error reporting in int().
+
+- Issue #17899: Fix rare file descriptor leak in os.listdir().
+
+- Issue #10241: Clear extension module dict copies at interpreter shutdown.
+ Patch by Neil Schemenauer, minimally modified.
+
+- Issue #9035: ismount now recognises volumes mounted below a drive root
+ on Windows. Original patch by Atsuo Ishimoto.
+
+- Issue #18214: Improve finalization of Python modules to avoid setting
+ their globals to None, in most cases.
+
+- Issue #18112: PEP 442 implementation (safe object finalization).
+
+- Issue #18552: Check return value of PyArena_AddPyObject() in
+ obj2ast_object().
+
+- Issue #18560: Fix potential NULL pointer dereference in sum().
+
+- Issue #18520: Add a new PyStructSequence_InitType2() function, same than
+ PyStructSequence_InitType() except that it has a return value (0 on success,
+ -1 on error).
+
+- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0],
+ prefix and exec_prefix if the operation system does not obey MAXPATHLEN.
+
+- Issue #18408: Fix many various bugs in code handling errors, especially
+ on memory allocation failure (MemoryError).
+
+- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all().
+
+- Issue #18342: Use the repr of a module name when an import fails when using
+ ``from ... import ...``.
+
+- Issue #17872: Fix a segfault in marshal.load() when input stream returns
+ more bytes than requested.
+
+- Issue #18338: `python --version` now prints version string to stdout, and
+ not to stderr. Patch by Berker Peksag and Michael Dickens.
+
+- Issue #18426: Fix NULL pointer dereference in C extension import when
+ PyModule_GetDef() returns an error.
+
+- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix
+ a stack overflow in the marshal module (fix a crash in test_marshal).
+ Patch written by Jeremy Kloth.
+
+- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory
+ allocators.
+
+- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the
+ tstate is first removed from TLS and then deallocated.
+
+- Issue #13483: Use VirtualAlloc in obmalloc on Windows.
+
+- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise
+ OverflowError when an argument of %c format is out of range.
+
+- Issue #18111: The min() and max() functions now support a default argument
+ to be returned instead of raising a ValueError on an empty sequence.
+ (Contributed by Julian Berman.)
+
+- Issue #18137: Detect integer overflow on precision in float.__format__()
+ and complex.__format__().
+
+- Issue #18183: Fix various unicode operations on strings with large unicode
+ codepoints.
+
+- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows().
+
+- Issue #18038: SyntaxError raised during compilation sources with illegal
+ encoding now always contains an encoding name.
+
+- Issue #17931: Resolve confusion on Windows between pids and process
+ handles.
+
+- Tweak the exception message when the magic number or size value in a bytecode
+ file is truncated.
+
+- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators:
+ change the C type of seqiterobject.it_index from long to Py_ssize_t.
+
+- Issue #18065: Don't set __path__ to the package name for frozen packages.
+
+- Issue #18088: When reloading a module, unconditionally reset all relevant
+ attributes on the module (e.g. __name__, __loader__, __package__, __file__,
+ __cached__).
+
+- Issue #17937: Try harder to collect cyclic garbage at shutdown.
+
+- Issue #12370: Prevent class bodies from interfering with the __class__
+ closure.
+
+- Issue #17644: Fix a crash in str.format when curly braces are used in square
+ brackets.
+
+- Issue #17237: Fix crash in the ASCII decoder on m68k.
+
+- Issue #17927: Frame objects kept arguments alive if they had been
+ copied into a cell, even if the cell was cleared.
+
+- Issue #1545463: At shutdown, defer finalization of codec modules so
+ that stderr remains usable.
+
+- Issue #7330: Implement width and precision (ex: "%5.3s") for the format
+ string of PyUnicode_FromFormat() function, original patch written by Ysj Ray.
+
+- Issue #1545463: Global variables caught in reference cycles are now
+ garbage-collected at shutdown.
+
+- Issue #17094: Clear stale thread states after fork(). Note that this
+ is a potentially disruptive change since it may release some system
+ resources which would otherwise remain perpetually alive (e.g. database
+ connections kept in thread-local storage).
+
+- Issue #17408: Avoid using an obsolete instance of the copyreg module when
+ the interpreter is shutdown and then started again.
+
+- Issue #5845: Enable tab-completion in the interactive interpreter by
+ default, thanks to a new sys.__interactivehook__.
+
+- Issue #17115,17116: Module initialization now includes setting __package__ and
+ __loader__ attributes to None.
+
+- Issue #17853: Ensure locals of a class that shadow free variables always win
+ over the closures.
+
+- Issue #17863: In the interactive console, don't loop forever if the encoding
+ can't be fetched from stdin.
+
+- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__.
+
+- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules.
+
+- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
+ such as was shipped with Centos 5 and Mac OS X 10.4.
+
+- Issue #17413: sys.settrace callbacks were being passed a string instead of an
+ exception instance for the 'value' element of the arg tuple if the exception
+ originated from C code; now an exception instance is always provided.
+
+- Issue #17782: Fix undefined behaviour on platforms where
+ ``struct timespec``'s "tv_nsec" member is not a C long.
+
+- Issue #17722: When looking up __round__, resolve descriptors.
+
+- Issue #16061: Speed up str.replace() for replacing 1-character strings.
+
+- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__
+ method.
+
+- Issue #17643: Add __callback__ attribute to weakref.ref.
+
+- Issue #16447: Fixed potential segmentation fault when setting __name__ on a
+ class.
+
+- Issue #17669: Fix crash involving finalization of generators using yield from.
+
+- Issue #14439: Python now prints the traceback on runpy failure at startup.
+
+
+- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks()
+ when running on valgrind.
+
+- Issue #17619: Make input() check for Ctrl-C correctly on Windows.
+
+- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during
+ the importlib transition.
+
+- Issue #17610: Don't rely on non-standard behavior of the C qsort() function.
+
+- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been
+ disabled by default. It can be re-enabled with the `-X showrefcount` option.
+
+Library
+-------
+
+- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit
+ platforms. Patch by Yogesh Chaudhari.
+
+- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li).
+
+- Issue #14323: Expanded the number of digits in the coefficients for the
+ RGB -- YIQ conversions so that they match the FCC NTSC versions.
+
- Issue #17998: Fix an internal error in regular expression engine.
- Issue #17557: Fix os.getgroups() to work with the modified behavior of
memset(buf, '\0', soself->s_size);
i = offset;
for (code = soself->s_codes; code->fmtdef != NULL; code++) {
- Py_ssize_t n;
- PyObject *v = PyTuple_GET_ITEM(args, i++);
const formatdef *e = code->fmtdef;
char *res = buf + code->offset;
- if (e->format == 's') {
- int isstring;
- void *p;
- isstring = PyBytes_Check(v);
- if (!isstring && !PyByteArray_Check(v)) {
- PyErr_SetString(StructError,
- "argument for 's' must be a bytes object");
- return -1;
- }
- if (isstring) {
- n = PyBytes_GET_SIZE(v);
- p = PyBytes_AS_STRING(v);
- }
- else {
- n = PyByteArray_GET_SIZE(v);
- p = PyByteArray_AS_STRING(v);
- }
- if (n > code->size)
- n = code->size;
- if (n > 0)
- memcpy(res, p, n);
- } else if (e->format == 'p') {
- int isstring;
- void *p;
- isstring = PyBytes_Check(v);
- if (!isstring && !PyByteArray_Check(v)) {
- PyErr_SetString(StructError,
- "argument for 'p' must be a bytes object");
- return -1;
- }
- if (isstring) {
- n = PyBytes_GET_SIZE(v);
- p = PyBytes_AS_STRING(v);
- }
- else {
- n = PyByteArray_GET_SIZE(v);
- p = PyByteArray_AS_STRING(v);
- }
- if (n > (code->size - 1))
- n = code->size - 1;
- if (n > 0)
- memcpy(res + 1, p, n);
- if (n > 255)
- n = 255;
- *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char);
- } else {
- if (e->pack(res, v, e) < 0) {
- if (PyLong_Check(v) && PyErr_ExceptionMatches(PyExc_OverflowError))
+ Py_ssize_t j = code->repeat;
+ while (j--) {
+ PyObject *v = PyTuple_GET_ITEM(args, i++);
+ if (e->format == 's') {
+ Py_ssize_t n;
+ int isstring;
+ void *p;
+ isstring = PyBytes_Check(v);
+ if (!isstring && !PyByteArray_Check(v)) {
PyErr_SetString(StructError,
- "int too large to convert");
- return -1;
+ "argument for 's' must be a bytes object");
+ return -1;
+ }
+ if (isstring) {
+ n = PyBytes_GET_SIZE(v);
+ p = PyBytes_AS_STRING(v);
+ }
+ else {
+ n = PyByteArray_GET_SIZE(v);
+ p = PyByteArray_AS_STRING(v);
+ }
+ if (n > code->size)
+ n = code->size;
+ if (n > 0)
+ memcpy(res, p, n);
+ } else if (e->format == 'p') {
+ Py_ssize_t n;
+ int isstring;
+ void *p;
+ isstring = PyBytes_Check(v);
+ if (!isstring && !PyByteArray_Check(v)) {
+ PyErr_SetString(StructError,
+ "argument for 'p' must be a bytes object");
+ return -1;
+ }
+ if (isstring) {
+ n = PyBytes_GET_SIZE(v);
+ p = PyBytes_AS_STRING(v);
+ }
+ else {
+ n = PyByteArray_GET_SIZE(v);
+ p = PyByteArray_AS_STRING(v);
+ }
+ if (n > (code->size - 1))
+ n = code->size - 1;
+ if (n > 0)
+ memcpy(res + 1, p, n);
+ if (n > 255)
+ n = 255;
+ *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char);
+ } else {
+ if (e->pack(res, v, e) < 0) {
+ if (PyLong_Check(v) && PyErr_ExceptionMatches(PyExc_OverflowError))
+ PyErr_SetString(StructError,
- "long too large to convert to int");
++ "int too large to convert");
+ return -1;
+ }
}
+ res += code->size;
}
}
#define maybe_small_long(val) (val)
#endif
- /* If a freshly-allocated long is already shared, it must
+ /* If a freshly-allocated int is already shared, it must
be a small integer, so negating it must go to PyLong_FromLong */
-#define NEGATE(x) \
- do if (Py_REFCNT(x) == 1) Py_SIZE(x) = -Py_SIZE(x); \
- else { PyObject* tmp=PyLong_FromLong(-MEDIUM_VALUE(x)); \
- Py_DECREF(x); (x) = (PyLongObject*)tmp; } \
- while(0)
+Py_LOCAL_INLINE(void)
+_PyLong_Negate(PyLongObject **x_p)
+{
+ PyLongObject *x;
+
+ x = (PyLongObject *)*x_p;
+ if (Py_REFCNT(x) == 1) {
+ Py_SIZE(x) = -Py_SIZE(x);
+ return;
+ }
+
+ *x_p = (PyLongObject *)PyLong_FromLong(-MEDIUM_VALUE(x));
+ Py_DECREF(x);
+}
+
- /* For long multiplication, use the O(N**2) school algorithm unless
+ /* For int multiplication, use the O(N**2) school algorithm unless
* both operands contain more than KARATSUBA_CUTOFF digits (this
- * being an internal Python long digit, in base BASE).
+ * being an internal Python int digit, in base BASE).
*/
#define KARATSUBA_CUTOFF 70
#define KARATSUBA_SQUARE_CUTOFF (2 * KARATSUBA_CUTOFF)
* rewritten to use the newer PyLong_{As,From}ByteArray API.
*/
-#define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one
#define PY_ABS_LLONG_MIN (0-(unsigned PY_LONG_LONG)PY_LLONG_MIN)
- /* Create a new long int object from a C PY_LONG_LONG int. */
+ /* Create a new int object from a C PY_LONG_LONG int. */
PyObject *
PyLong_FromLongLong(PY_LONG_LONG ival)
return (unsigned PY_LONG_LONG)-1;
}
}
-#undef IS_LITTLE_ENDIAN
- /* Get a C long long int from a long int object or any object that has an
+ /* Get a C long long int from an int object or any object that has an
__int__ method.
On overflow, return -1 and set *overflow to 1 or -1 depending on the sign of