]> granicus.if.org Git - python/commitdiff
Issue #23392: Added tests for marshal C API that works with FILE*.
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 6 Feb 2015 07:00:44 +0000 (09:00 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 6 Feb 2015 07:00:44 +0000 (09:00 +0200)
1  2 
Lib/test/test_marshal.py
Misc/NEWS
Modules/_testcapimodule.c

Simple merge
diff --cc Misc/NEWS
index e05e6137ce130f0f4451678c41b643d506c2c265,1fedcf5c2b4964d2e88073d11e7fce191beb5ab8..25ea656b53929b63ba414bdf4c0bc7e3610fb3de
+++ b/Misc/NEWS
@@@ -604,76 -280,215 +604,78 @@@ Librar
  
  - Issue #20079: Added locales supported in glibc 2.18 to locale alias table.
  
 -- Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor
 -  os.posix_fallocate() because their prototypes in system headers are wrong.
 +- Issue #20218: Added convenience methods read_text/write_text and read_bytes/
 +  write_bytes to pathlib.Path objects.
  
 -- Issue #22517: When a io.BufferedRWPair object is deallocated, clear its
 -  weakrefs.
 +- Issue #22437: Number of capturing groups in regular expression is no longer
 +  limited by 100.
  
 -- Issue #22448: Improve canceled timer handles cleanup to prevent
 -  unbound memory usage. Patch by Joshua Moore-Oliva.
 +- Issue #17442: InteractiveInterpreter now displays the full chained traceback
 +  in its showtraceback method, to match the built in interactive interpreter.
  
 -- Issue #23009: Make sure selectors.EpollSelecrtor.select() works when no
 -  FD is registered.
++- Issue #23392: Added tests for marshal C API that works with FILE*.
 -IDLE
 -----
 +- Issue #10510: distutils register and upload methods now use HTML standards
 +  compliant CRLF line endings.
  
 -- Issue #20577: Configuration of the max line length for the FormatParagraph
 -  extension has been moved from the General tab of the Idle preferences dialog
 -  to the FormatParagraph tab of the Config Extensions dialog.
 -  Patch by Tal Einat.
 +- Issue #9850: Fixed macpath.join() for empty first component.  Patch by
 +  Oleg Oshmyan.
  
 -- Issue #16893: Update Idle doc chapter to match current Idle and add new
 -  information.
 +- Issue #5309: distutils' build and build_ext commands now accept a ``-j``
 +  option to enable parallel building of extension modules.
  
 -- Issue #3068: Add Idle extension configuration dialog to Options menu.
 -  Changes are written to HOME/.idlerc/config-extensions.cfg.
 -  Original patch by Tal Einat.
 +- Issue #22448: Improve canceled timer handles cleanup to prevent
 +  unbound memory usage. Patch by Joshua Moore-Oliva.
  
 -- Issue #16233: A module browser (File : Class Browser, Alt+C) requires a
 -  editor window with a filename.  When Class Browser is requested otherwise,
 -  from a shell, output window, or 'Untitled' editor, Idle no longer displays
 -  an error box.  It now pops up an  Open Module box (Alt+M). If a valid name
 -  is entered and a module is opened, a corresponding browser is also opened.
 +- Issue #22427: TemporaryDirectory no longer attempts to clean up twice when
 +  used in the with statement in generator.
  
 -- Issue #4832: Save As to type Python files automatically adds .py to the
 -  name you enter (even if your system does not display it).  Some systems
 -  automatically add .txt when type is Text files.
 +- Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in
 +  regular expressions.
  
 -- Issue #21986: Code objects are not normally pickled by the pickle module.
 -  To match this, they are no longer pickled when running under Idle.
 +- Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS
 +  directory attributes.
  
 -- Issue #23180: Rename IDLE "Windows" menu item to "Window".
 -  Patch by Al Sweigart.
 +- Issue #21866: ZipFile.close() no longer writes ZIP64 central directory
 +  records if allowZip64 is false.
  
 -Tests
 ------
 +- Issue #22278: Fix urljoin problem with relative urls, a regression observed
 +  after changes to issue22118 were submitted.
  
 -- Issue #23392: Added tests for marshal C API that works with FILE*.
 +- Issue #22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re
 +  module.  Removed trailing spaces in debugging output.
  
 -- Issue #18982: Add tests for CLI of the calendar module.
 +- Issue #22423: Unhandled exception in thread no longer causes unhandled
 +  AttributeError when sys.stderr is None.
  
 -- Issue #19548: Added some additional checks to test_codecs to ensure that
 -  statements in the updated documentation remain accurate. Patch by Martin
 -  Panter.
 +- Issue #21332: Ensure that ``bufsize=1`` in subprocess.Popen() selects
 +  line buffering, rather than block buffering.  Patch by Akira Li.
  
 -- Issue #22838: All test_re tests now work with unittest test discovery.
 +- Issue #21091: Fix API bug: email.message.EmailMessage.is_attachment is now
 +  a method.
  
 -- Issue #22173: Update lib2to3 tests to use unittest test discovery.
 +- Issue #21079: Fix email.message.EmailMessage.is_attachment to return the
 +  correct result when the header has parameters as well as a value.
  
 -- Issue #16000: Convert test_curses to use unittest.
 +- Issue #22247: Add NNTPError to nntplib.__all__.
  
 -- Issue #21456: Skip two tests in test_urllib2net.py if _ssl module not
 -  present. Patch by Remi Pointel.
 +- Issue #22366: urllib.request.urlopen will accept a context object
 +  (SSLContext) as an argument which will then used be for HTTPS connection.
 +  Patch by Alex Gaynor.
  
 -- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
 +- Issue #4180: The warnings registries are now reset when the filters
 +  are modified.
  
 -- Issue #23211: Workaround test_logging failure on some OS X 10.6 systems.
 +- Issue #22419: Limit the length of incoming HTTP request in wsgiref server to
 +  65536 bytes and send a 414 error code for higher lengths. Patch contributed
 +  by Devin Cook.
  
 -- Issue #23345: Prevent test_ssl failures with large OpenSSL patch level
 -  values (like 0.9.8zc).
 +- Lax cookie parsing in http.cookies could be a security issue when combined
 +  with non-standard cookie handling in some Web browsers.  Reported by
 +  Sergey Bobrov.
  
 -Build
 ------
 -
 -- Issue #15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure
 -  script.
 -
 -- Issue #22935: Allow the ssl module to be compiled if openssl doesn't support
 -  SSL 3.
 -
 -- Issue #16537: Check whether self.extensions is empty in setup.py. Patch by
 -  Jonathan Hosmer.
 -
 -- Issue #18096: Fix library order returned by python-config.
 -
 -- Issue #17219: Add library build dir for Python extension cross-builds.
 -
 -- Issue #17128: Use private version of OpenSSL for 3.4.3 OS X 10.5+ installer.
 -
 -C API
 ------
 -
 -- Issue #22079: PyType_Ready() now checks that statically allocated type has
 -  no dynamically allocated bases.
 -
 -Documentation
 --------------
 -
 -- Issue #19548: Update the codecs module documentation to better cover the
 -  distinction between text encodings and other codecs, together with other
 -  clarifications. Patch by Martin Panter.
 -
 -- Issue #22914: Update the Python 2/3 porting HOWTO to describe a more automated
 -  approach.
 -
 -- Issue #21514: The documentation of the json module now refers to new JSON RFC
 -  7159 instead of obsoleted RFC 4627.
 -
 -Tools/Demos
 ------------
 -
 -- Issue #22314: pydoc now works when the LINES environment variable is set.
 -
 -Windows
 --------
 -
 -- Issue #17896: The Windows build scripts now expect external library sources
 -  to be in ``PCbuild\..\externals`` rather than ``PCbuild\..\..``.
 -
 -- Issue #17717: The Windows build scripts now use a copy of NASM pulled from
 -  svn.python.org to build OpenSSL.
 -
 -- Issue #22644: The bundled version of OpenSSL has been updated to 1.0.1j.
 -
 -What's New in Python 3.4.2?
 -===========================
 -
 -Release date: 2014-10-06
 -
 -Core and Builtins
 ------------------
 -
 -Library
 --------
 -
 -- Issue #10510: distutils register and upload methods now use HTML standards
 -  compliant CRLF line endings.
 -
 -- Issue #9850: Fixed macpath.join() for empty first component.  Patch by
 -  Oleg Oshmyan.
 -
 -- Issue #22427: TemporaryDirectory no longer attempts to clean up twice when
 -  used in the with statement in generator.
 -
 -- Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS
 -  directory attributes.
 -
 -- Issue #21866: ZipFile.close() no longer writes ZIP64 central directory
 -  records if allowZip64 is false.
 -
 -- Issue #22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re
 -  module.  Removed trailing spaces in debugging output.
 -
 -- Issue #22423: Unhandled exception in thread no longer causes unhandled
 -  AttributeError when sys.stderr is None.
 -
 -- Issue #21332: Ensure that ``bufsize=1`` in subprocess.Popen() selects
 -  line buffering, rather than block buffering.  Patch by Akira Li.
 -
 -
 -What's New in Python 3.4.2rc1?
 -==============================
 -
 -Release date: 2014-09-22
 -
 -Core and Builtins
 ------------------
 -
 -- Issue #22258: Fix the the internal function set_inheritable() on Illumos.
 -  This platform exposes the function ``ioctl(FIOCLEX)``, but calling it fails
 -  with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable()
 -  now falls back to the slower ``fcntl()`` (``F_GETFD`` and then ``F_SETFD``).
 -
 -- Issue #21669: With the aid of heuristics in SyntaxError.__init__, the
 -  parser now attempts to generate more meaningful (or at least more search
 -  engine friendly) error messages when "exec" and "print" are used as
 -  statements.
 -
 -- Issue #21642: If the conditional if-else expression, allow an integer written
 -  with no space between itself and the ``else`` keyword (e.g. ``True if 42else
 -  False``) to be valid syntax.
 -
 -- Issue #21523: Fix over-pessimistic computation of the stack effect of
 -  some opcodes in the compiler.  This also fixes a quadratic compilation
 -  time issue noticeable when compiling code with a large number of "and"
 -  and "or" operators.
 -
 -Library
 --------
 -
 -- Issue #21091: Fix API bug: email.message.EmailMessage.is_attachment is now
 -  a method.  Since EmailMessage is provisional, we can change the API in a
 -  maintenance release, but we use a trick to remain backward compatible with
 -  3.4.0/1.
 -
 -- Issue #21079: Fix email.message.EmailMessage.is_attachment to return the
 -  correct result when the header has parameters as well as a value.
 -
 -- Issue #22247: Add NNTPError to nntplib.__all__.
 -
 -- Issue #4180: The warnings registries are now reset when the filters
 -  are modified.
 -
 -- Issue #22419: Limit the length of incoming HTTP request in wsgiref server to
 -  65536 bytes and send a 414 error code for higher lengths. Patch contributed
 -  by Devin Cook.
 -
 -- Lax cookie parsing in http.cookies could be a security issue when combined
 -  with non-standard cookie handling in some Web browsers.  Reported by
 -  Sergey Bobrov.
 +- Issue #20537: logging methods now accept an exception instance as well as a
 +  Boolean value or exception tuple. Thanks to Yury Selivanov for the patch.
  
  - Issue #22384: An exception in Tkinter callback no longer crashes the program
    when it is run with pythonw.exe.
index 465826065f6a1a0569e98b625b7f6a0b534b958d,625409e56f674c9365ed3fb98eb6dead9296c0bc..bed6568990e64d25c7384823fed602a0934756a7
@@@ -11,7 -11,7 +11,8 @@@
  #include <float.h>
  #include "structmember.h"
  #include "datetime.h"
+ #include "marshal.h"
 +#include <signal.h>
  
  #ifdef WITH_THREAD
  #include "pythread.h"
  }
  #endif   /* WITH_THREAD */
  
 +static PyObject*
 +test_raise_signal(PyObject* self, PyObject *args)
 +{
 +    int signum, err;
 +
 +    if (PyArg_ParseTuple(args, "i:raise_signal", &signum) < 0)
 +        return NULL;
 +
 +    err = raise(signum);
 +    if (err)
 +        return PyErr_SetFromErrno(PyExc_OSError);
 +
 +    if (PyErr_CheckSignals() < 0)
 +        return NULL;
 +
 +    Py_RETURN_NONE;
 +}
 +
+ /* marshal */
+ static PyObject*
+ pymarshal_write_long_to_file(PyObject* self, PyObject *args)
+ {
+     long value;
+     char *filename;
+     int version;
+     FILE *fp;
+     if (!PyArg_ParseTuple(args, "lsi:pymarshal_write_long_to_file",
+                           &value, &filename, &version))
+         return NULL;
+     fp = fopen(filename, "wb");
+     if (fp == NULL) {
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+     PyMarshal_WriteLongToFile(value, fp, version);
+     fclose(fp);
+     if (PyErr_Occurred())
+         return NULL;
+     Py_RETURN_NONE;
+ }
+ static PyObject*
+ pymarshal_write_object_to_file(PyObject* self, PyObject *args)
+ {
+     PyObject *obj;
+     char *filename;
+     int version;
+     FILE *fp;
+     if (!PyArg_ParseTuple(args, "Osi:pymarshal_write_object_to_file",
+                           &obj, &filename, &version))
+         return NULL;
+     fp = fopen(filename, "wb");
+     if (fp == NULL) {
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+     PyMarshal_WriteObjectToFile(obj, fp, version);
+     fclose(fp);
+     if (PyErr_Occurred())
+         return NULL;
+     Py_RETURN_NONE;
+ }
+ static PyObject*
+ pymarshal_read_short_from_file(PyObject* self, PyObject *args)
+ {
+     int value;
+     long pos;
+     char *filename;
+     FILE *fp;
+     if (!PyArg_ParseTuple(args, "s:pymarshal_read_short_from_file", &filename))
+         return NULL;
+     fp = fopen(filename, "rb");
+     if (fp == NULL) {
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+     value = PyMarshal_ReadShortFromFile(fp);
+     pos = ftell(fp);
+     fclose(fp);
+     if (PyErr_Occurred())
+         return NULL;
+     return Py_BuildValue("il", value, pos);
+ }
+ static PyObject*
+ pymarshal_read_long_from_file(PyObject* self, PyObject *args)
+ {
+     long value, pos;
+     char *filename;
+     FILE *fp;
+     if (!PyArg_ParseTuple(args, "s:pymarshal_read_long_from_file", &filename))
+         return NULL;
+     fp = fopen(filename, "rb");
+     if (fp == NULL) {
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+     value = PyMarshal_ReadLongFromFile(fp);
+     pos = ftell(fp);
+     fclose(fp);
+     if (PyErr_Occurred())
+         return NULL;
+     return Py_BuildValue("ll", value, pos);
+ }
+ static PyObject*
+ pymarshal_read_last_object_from_file(PyObject* self, PyObject *args)
+ {
+     PyObject *obj;
+     long pos;
+     char *filename;
+     FILE *fp;
+     if (!PyArg_ParseTuple(args, "s:pymarshal_read_last_object_from_file", &filename))
+         return NULL;
+     fp = fopen(filename, "rb");
+     if (fp == NULL) {
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+     obj = PyMarshal_ReadLastObjectFromFile(fp);
+     pos = ftell(fp);
+     fclose(fp);
+     return Py_BuildValue("Nl", obj, pos);
+ }
+ static PyObject*
+ pymarshal_read_object_from_file(PyObject* self, PyObject *args)
+ {
+     PyObject *obj;
+     long pos;
+     char *filename;
+     FILE *fp;
+     if (!PyArg_ParseTuple(args, "s:pymarshal_read_object_from_file", &filename))
+         return NULL;
+     fp = fopen(filename, "rb");
+     if (fp == NULL) {
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+     obj = PyMarshal_ReadObjectFromFile(fp);
+     pos = ftell(fp);
+     fclose(fp);
+     return Py_BuildValue("Nl", obj, pos);
+ }
  
  static PyMethodDef TestMethods[] = {
      {"raise_exception",         raise_exception,                 METH_VARARGS},