summaryrefslogtreecommitdiff
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2015-02-04 01:04:31 -0800
committerGregory P. Smith <greg@krypto.org>2015-02-04 01:04:31 -0800
commitef3e7a803f7e575ce26cb2e4e29e46da2d89c124 (patch)
treeec9df5664c8029412e3923f694c3bbbbc9434ee6 /Python/marshal.c
parentf97d8cc43c09116bebd4d54b7ef5baf472058de3 (diff)
parent7c584647e0c2fe3f84299cab3b7941d1595de32f (diff)
downloadcpython-ef3e7a803f7e575ce26cb2e4e29e46da2d89c124.tar.gz
Skip some tests that require a subinterpreter launched with -E or -I when the
interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a test.script_helper.interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 6f0ee5e83e..5acf0deeb4 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -13,15 +13,13 @@
#include "code.h"
#include "marshal.h"
-#define ABS(x) ((x) < 0 ? -(x) : (x))
-
/* High water mark to determine when the marshalled object is dangerously deep
* and risks coring the interpreter. When the object stack gets this deep,
* raise an exception instead of continuing.
* On Windows debug builds, reduce this value.
*/
#if defined(MS_WINDOWS) && defined(_DEBUG)
-#define MAX_MARSHAL_STACK_DEPTH 1500
+#define MAX_MARSHAL_STACK_DEPTH 1000
#else
#define MAX_MARSHAL_STACK_DEPTH 2000
#endif
@@ -192,7 +190,7 @@ w_PyLong(const PyLongObject *ob, char flag, WFILE *p)
}
/* set l to number of base PyLong_MARSHAL_BASE digits */
- n = ABS(Py_SIZE(ob));
+ n = Py_ABS(Py_SIZE(ob));
l = (n-1) * PyLong_MARSHAL_RATIO;
d = ob->ob_digit[n-1];
assert(d != 0); /* a PyLong is always normalized */
@@ -727,8 +725,8 @@ r_PyLong(RFILE *p)
return NULL;
}
- size = 1 + (ABS(n) - 1) / PyLong_MARSHAL_RATIO;
- shorts_in_top_digit = 1 + (ABS(n) - 1) % PyLong_MARSHAL_RATIO;
+ size = 1 + (Py_ABS(n) - 1) / PyLong_MARSHAL_RATIO;
+ shorts_in_top_digit = 1 + (Py_ABS(n) - 1) % PyLong_MARSHAL_RATIO;
ob = _PyLong_New(size);
if (ob == NULL)
return NULL;