]> granicus.if.org Git - python/commitdiff
Issue #18876: The FileIO.mode attribute now better reflects the actual mode under...
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 4 Sep 2013 18:52:14 +0000 (20:52 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 4 Sep 2013 18:52:14 +0000 (20:52 +0200)
Patch by Erik Bray.

1  2 
Lib/test/test_fileio.py
Misc/NEWS
Modules/_io/fileio.c

Simple merge
diff --cc Misc/NEWS
index af79d36e01dde0ca24b5fd8c17bb89a5ffafbde3,9a3ace5ce3af8190e227c33ed51b951f8fc2ea07..32effc6660a6a134d2a649a744bca2ed586f6c6d
+++ b/Misc/NEWS
@@@ -10,63 -12,62 +10,66 @@@ Projected Release date: 2013-09-0
  Core and Builtins
  -----------------
  
 -- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions.
 +- Issue #18571: Implementation of the PEP 446: file descriptors and file
 +  handles are now created non-inheritable; add functions
 +  os.get/set_inheritable(), os.get/set_handle_inheritable() and
 +  socket.socket.get/set_inheritable().
  
 -- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc()
 -  fails.
 +- Issue #11619: The parser and the import machinery do not encode Unicode
 +  filenames anymore on Windows.
  
 -- Issue #16741: Fix an error reporting in int().
 +- Issue #18808: Non-daemon threads are now automatically joined when
 +  a sub-interpreter is shutdown (it would previously dump a fatal error).
  
 -- Issue #17899: Fix rare file descriptor leak in os.listdir().
 +- Remove supporting for compiling on systems without getcwd().
  
 -- Issue #18552: Check return value of PyArena_AddPyObject() in
 -  obj2ast_object().
 +- Issue #18774: Remove last bits of GNU PTH thread code and thread_pth.h.
  
 -- Issue #18560: Fix potential NULL pointer dereference in sum().
 +- Issue #18771: Add optimization to set object lookups to reduce the cost
 +  of hash collisions.  The core idea is to inspect a second key/hash pair
 +  for each cache line retrieved.
  
 -- 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 #16105: When a signal handler fails to write to the file descriptor
 +  registered with ``signal.set_wakeup_fd()``, report an exception instead
 +  of ignoring the error.
  
 -- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all().
 +- Issue #18722: Remove uses of the "register" keyword in C code.
  
 -- Issue #17872: Fix a segfault in marshal.load() when input stream returns
 -  more bytes than requested.
 +- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions.
  
 -- Issue #18426: Fix NULL pointer dereference in C extension import when
 -  PyModule_GetDef() returns an error.
 +- Issue #16499: Add command line option for isolated mode.
  
 -- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the
 -  tstate is first removed from TLS and then deallocated.
 +- Issue #15301: Parsing fd, uid, and gid parameters for builtins
 +  in Modules/posixmodule.c is now far more robust.
  
 -- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise
 -  OverflowError when an argument of %c format is out of range.
 +- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc()
 +  fail.
  
 -- Issue #18137: Detect integer overflow on precision in float.__format__()
 -  and complex.__format__().
 +- Issue #17934: Add a clear() method to frame objects, to help clean up
 +  expensive details (local variables) and break reference cycles.
  
 -- Issue #18183: Fix various unicode operations on strings with large unicode
 -  codepoints.
 +- Issue #18780: %-formatting codes %d, %i, and %u now treat int-subclasses
 +  as int (displays value of int-subclass instead of str(int-subclass) ).
  
 -- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows().
 +Library
 +-------
  
 -- Issue #18038: SyntaxError raised during compilation sources with illegal
 -  encoding now always contains an encoding name.
++- Issue #18876: The FileIO.mode attribute now better reflects the actual mode
++  under which the file was opened.  Patch by Erik Bray.
 -- Issue #17644: Fix a crash in str.format when curly braces are used in square
 -  brackets.
 +- Issue #16853: Add new selectors module.
  
 -- Issue #17983: Raise a SyntaxError for a ``global __class__`` statement in a
 -  class body.
 +- Issue #18882: Add threading.main_thread() function.
  
 -- Issue #17927: Frame objects kept arguments alive if they had been copied into
 -  a cell, even if the cell was cleared.
 +- Issue #18901: The sunau getparams method now returns a namedtuple rather than
 +  a plain tuple.  Patch by Claudiu Popa.
  
 -Library
 --------
 +- Issue #17487: The result of the wave getparams method now is pickleable again.
 +  Patch by Claudiu Popa.
  
 -- Issue #18876: The FileIO.mode attribute now better reflects the actual mode
 -  under which the file was opened.  Patch by Erik Bray.
 +- Issue #18756: os.urandom() now uses a lazily-opened persistent file
 +  descriptor, so as to avoid using many file descriptors when run in
 +  parallel from multiple threads.
  
  - Issue #18418: After fork(), reinit all threads states, not only active ones.
    Patch by A. Jesse Jiryu Davis.
index e757c8263bdf00134c5df052ca23b8cd85d96f37,f3ce776993c03cc74cb85e7853f6d295890ad277..27995e543b03002861c421e0e465032734504b9a
@@@ -49,9 -49,10 +49,10 @@@ typedef struct 
      unsigned int created : 1;
      unsigned int readable : 1;
      unsigned int writable : 1;
+     unsigned int appending : 1;
      signed int seekable : 2; /* -1 means unknown */
      unsigned int closefd : 1;
 -    unsigned int deallocating: 1;
 +    char finalizing;
      PyObject *weakreflist;
      PyObject *dict;
  } fileio;
@@@ -349,16 -343,6 +351,12 @@@ fileio_init(PyObject *oself, PyObject *
      flags |= O_BINARY;
  #endif
  
- #ifdef O_APPEND
-     if (append)
-         flags |= O_APPEND;
- #endif
 +#ifdef MS_WINDOWS
 +    flags |= O_NOINHERIT;
 +#elif defined(O_CLOEXEC)
 +    flags |= O_CLOEXEC;
 +#endif
 +
      if (fd >= 0) {
          if (check_fd(fd))
              goto error;