]> granicus.if.org Git - python/commitdiff
Issue #20437: Fixed 22 potential bugs when deleting objects references.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 9 Feb 2014 11:46:20 +0000 (13:46 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 9 Feb 2014 11:46:20 +0000 (13:46 +0200)
15 files changed:
1  2 
Misc/NEWS
Modules/_ctypes/_ctypes.c
Modules/_sqlite/cursor.c
Modules/posixmodule.c
Modules/pyexpat.c
Modules/readline.c
Modules/selectmodule.c
Modules/signalmodule.c
Modules/syslogmodule.c
Modules/zlibmodule.c
Objects/tupleobject.c
Objects/unicodeobject.c
Python/ceval.c
Python/import.c
Python/sysmodule.c

diff --cc Misc/NEWS
index 20cf65610c09ef8f75e1bdc1f302fc253e31434d,0b42ab945fbef31006610f1296f7c400dcdcf62e..8bd0dd39da5f7c45f8c9af7327d51662bb849048
+++ b/Misc/NEWS
@@@ -10,22 -10,42 +10,24 @@@ Release date: 2014-02-0
  Core and Builtins
  -----------------
  
 -- Issue #20437: Fixed 21 potential bugs when deleting objects references.
++- Issue #20437: Fixed 22 potential bugs when deleting objects references.
 -- Issue #20538: UTF-7 incremental decoder produced inconsistant string when
 -  input was truncated in BASE64 section.
 -
 -- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and
 -  IndentationError.
 -
 -- Issue #2382: SyntaxError cursor "^" is now written at correct position in most
 -  cases when multibyte characters are in line (before "^").  This still not
 -  works correctly with wide East Asian characters.
 -
 -- Issue #18960: The first line of Python script could be executed twice when
 -  the source encoding was specified on the second line.  Now the source encoding
 -  declaration on the second line isn't effective if the first line contains
 -  anything except a comment.  'python -x' works now again with files with the
 -  source encoding declarations, and can be used to make Python batch files
 -  on Windows.
 -
 -- Issue #17432: Drop UCS2 from names of Unicode functions in python3.def.
 -
 -- Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c"
 -  argument is not in range [0; 255].
 +- Issue #20500: Displaying an exception at interpreter shutdown no longer
 +  risks triggering an assertion failure in PyObject_Str.
  
 -- Issue #14432: Generator now clears the borrowed reference to the thread
 -  state. Fix a crash when a generator is created in a C thread that is
 -  destroyed while the generator is still used. The issue was that a generator
 -  contains a frame, and the frame kept a reference to the Python state of the
 -  destroyed C thread. The crash occurs when a trace function is setup.
 +- Issue #20538: UTF-7 incremental decoder produced inconsistent string when
 +  input was truncated in BASE64 section.
  
 -- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes.
 +- Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the
 +  internal codec marking system added for issue #19619 to throw LookupError
 +  for known non-text encodings at stream construction time. The existing
 +  output type checks remain in place to deal with unmarked third party
 +  codecs.
  
 -- Issue #19729: In str.format(), fix recursive expansion in format spec.
 +- Issue #17162: Add PyType_GetSlot.
  
 -- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2
 -  billion characters) input strings in _Py_dg_strtod.
 +- Issue #20162: Fix an alignment issue in the siphash24() hash function which
 +  caused a crash on PowerPC 64-bit (ppc64).
  
  Library
  -------
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 2ba264fb655488f9e961b6d71721189b8115b911,1d1072dcea136a1f94226695455a54d67df4f881..52744b967ebd607ab742ad079d06c96ad7f42c46
@@@ -463,9 -392,10 +463,8 @@@ zlib_compressobj_impl(PyModuleDef *modu
      }
  
   error:
-     Py_XDECREF(self);
-     self = NULL;
+     Py_CLEAR(self);
   success:
 -    if (zdict.buf != NULL)
 -        PyBuffer_Release(&zdict);
      return (PyObject*)self;
  }
  
Simple merge
index eae4bc5bff6fb304c315fd9f2eda17bfb85a4cc9,e1ff999e136980c23c6a9cc723d2f0f5278c2141..994c4f570f7f27a958bbefc5fae7e8414c0a1173
@@@ -4005,11 -4081,9 +4004,10 @@@ make_decode_exception(PyObject **except
      return;
  
  onError:
-     Py_DECREF(*exceptionObject);
-     *exceptionObject = NULL;
+     Py_CLEAR(*exceptionObject);
  }
  
 +#ifdef HAVE_MBCS
  /* error handling callback helper:
     build arguments, call the callback and check the arguments,
     if no exception occurred, copy the replacement to the output
@@@ -13502,8 -12936,7 +13498,7 @@@ _PyUnicodeWriter_Finish(_PyUnicodeWrite
          PyObject *newbuffer;
          newbuffer = resize_compact(writer->buffer, writer->pos);
          if (newbuffer == NULL) {
--            Py_DECREF(writer->buffer);
-             writer->buffer = NULL;
++            Py_CLEAR(writer->buffer);
              return NULL;
          }
          writer->buffer = newbuffer;
diff --cc Python/ceval.c
index 34c52b032fd73258b3fc0df9e46d5b0bb0b4c37b,2b1619163bd1256a067edc9079f85f80d4fa2df2..5db88be620724c57d5ba1d7af6d1262362e87ac4
@@@ -3186,11 -3046,10 +3186,10 @@@ fast_yield
      if (tstate->use_tracing) {
          if (tstate->c_tracefunc) {
              if (why == WHY_RETURN || why == WHY_YIELD) {
 -                if (call_trace(tstate->c_tracefunc,
 -                               tstate->c_traceobj, f,
 +                if (call_trace(tstate->c_tracefunc, tstate->c_traceobj,
 +                               tstate, f,
                                 PyTrace_RETURN, retval)) {
-                     Py_XDECREF(retval);
-                     retval = NULL;
+                     Py_CLEAR(retval);
                      why = WHY_EXCEPTION;
                  }
              }
          if (tstate->c_profilefunc) {
              if (why == WHY_EXCEPTION)
                  call_trace_protected(tstate->c_profilefunc,
 -                                     tstate->c_profileobj, f,
 +                                     tstate->c_profileobj,
 +                                     tstate, f,
                                       PyTrace_RETURN, NULL);
 -            else if (call_trace(tstate->c_profilefunc,
 -                                tstate->c_profileobj, f,
 +            else if (call_trace(tstate->c_profilefunc, tstate->c_profileobj,
 +                                tstate, f,
                                  PyTrace_RETURN, retval)) {
-                 Py_XDECREF(retval);
-                 retval = NULL;
+                 Py_CLEAR(retval);
                  /* why = WHY_EXCEPTION; */
              }
          }
diff --cc Python/import.c
Simple merge
index 976d5a0c37d905e77ed7af1448c0ebc0bd2cf1b9,2f700e65071340e3537c606c7834d04fa5de6175..9ec3bfa07b5050ec0fe174395b193475b033dffb
@@@ -427,11 -392,10 +427,10 @@@ trace_trampoline(PyObject *self, PyFram
          callback = frame->f_trace;
      if (callback == NULL)
          return 0;
 -    result = call_trampoline(tstate, callback, frame, what, arg);
 +    result = call_trampoline(callback, frame, what, arg);
      if (result == NULL) {
          PyEval_SetTrace(NULL, NULL);
-         Py_XDECREF(frame->f_trace);
-         frame->f_trace = NULL;
+         Py_CLEAR(frame->f_trace);
          return -1;
      }
      if (result != Py_None) {