Skip to content

Instantly share code, notes, and snippets.

@tweksteen
Created October 31, 2017 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tweksteen/ed516ca7ab7dfa8d18428f59d9c22a3e to your computer and use it in GitHub Desktop.
Save tweksteen/ed516ca7ab7dfa8d18428f59d9c22a3e to your computer and use it in GitHub Desktop.
diff -ub src/cpython/Python/marshal.c PyMod-2.7.2/Python/marshal.c
--- src/cpython/Python/marshal.c 2017-10-31 10:05:43.257268157 +0100
+++ PyMod-2.7.2/Python/marshal.c 2017-10-24 15:46:13.458768912 +0200
@@ -1,8 +1,18 @@
-
-/* Write Python objects to files and read them back.
+/** @file
+ Write Python objects to files and read them back.
This is intended for writing and reading compiled Python code only;
a true persistent storage facility would be much harder, since
- it would have to take circular links and sharing into account. */
+ it would have to take circular links and sharing into account.
+
+ Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available under
+ the terms and conditions of the BSD License that accompanies this distribution.
+ The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#define PY_SSIZE_T_CLEAN
@@ -11,7 +21,9 @@
#include "code.h"
#include "marshal.h"
-#define ABS(x) ((x) < 0 ? -(x) : (x))
+#ifndef ABS
+ #define ABS(x) ((x) < 0 ? -(x) : (x))
+#endif
/* High water mark to determine when the marshalled object is dangerously deep
* and risks coring the interpreter. When the object stack gets this deep,
@@ -1277,7 +1289,7 @@
open() or os.popen(). It must be opened in binary mode ('wb' or 'w+b').\n\
\n\
If the value has (or contains an object that has) an unsupported type, a\n\
-ValueError exception is raised — but garbage data will also be written\n\
+ValueError exception is raised - but garbage data will also be written\n\
to the file. The object will not be properly read back by load()\n\
\n\
New in version 2.4: The version argument indicates the data format that\n\
@@ -1305,7 +1317,7 @@
"load(file)\n\
\n\
Read one value from the open file and return it. If no valid value is\n\
-read (e.g. because the data has a different Python version’s\n\
+read (e.g. because the data has a different Python version's\n\
incompatible marshal format), raise EOFError, ValueError or TypeError.\n\
The file must be an open file object opened in binary mode ('rb' or\n\
'r+b').\n\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment