]> granicus.if.org Git - python/commitdiff
Issue #28139: Fix messed up indentation
authorMartin Panter <vadmium+py@gmail.com>
Sat, 17 Sep 2016 07:54:55 +0000 (07:54 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 17 Sep 2016 07:54:55 +0000 (07:54 +0000)
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.

52 files changed:
Include/unicodeobject.h
Mac/Modules/cf/_CFmodule.c
Mac/Modules/ctl/_Ctlmodule.c
Mac/Modules/dlg/_Dlgmodule.c
Mac/Modules/drag/_Dragmodule.c
Mac/Modules/evt/_Evtmodule.c
Mac/Modules/file/_Filemodule.c
Mac/Modules/fm/_Fmmodule.c
Mac/Modules/folder/_Foldermodule.c
Mac/Modules/help/_Helpmodule.c
Mac/Modules/icn/_Icnmodule.c
Mac/Modules/launch/_Launchmodule.c
Mac/Modules/list/_Listmodule.c
Mac/Modules/menu/_Menumodule.c
Mac/Modules/mlte/_Mltemodule.c
Mac/Modules/osa/_OSAmodule.c
Mac/Modules/qd/_Qdmodule.c
Mac/Modules/qdoffs/_Qdoffsmodule.c
Mac/Modules/qt/_Qtmodule.c
Mac/Modules/res/_Resmodule.c
Mac/Modules/scrap/_Scrapmodule.c
Mac/Modules/snd/_Sndmodule.c
Mac/Modules/te/_TEmodule.c
Mac/Modules/win/_Winmodule.c
Modules/_ctypes/_ctypes.c
Modules/_localemodule.c
Modules/_multiprocessing/connection.h
Modules/binascii.c
Modules/bsddbmodule.c
Modules/cPickle.c
Modules/cStringIO.c
Modules/clmodule.c
Modules/dlmodule.c
Modules/fcntlmodule.c
Modules/flmodule.c
Modules/fmmodule.c
Modules/glmodule.c
Modules/main.c
Modules/signalmodule.c
Modules/socketmodule.c
Modules/timingmodule.c
Objects/complexobject.c
Objects/funcobject.c
Objects/intobject.c
Objects/rangeobject.c
Objects/stringobject.c
PC/bdist_wininst/install.c
PC/os2vacpp/getpathp.c
Python/bltinmodule.c
Python/mactoolboxglue.c
Python/thread_wince.h
RISCOS/Modules/riscosmodule.c

index 9ac73d46fbcf625bfb94265e8fb6d75eb1023b7e..7781f9663015fbb8616b26f9b4922ef93e860b5f 100644 (file)
@@ -395,7 +395,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
 
 #define Py_UNICODE_FILL(target, value, length) \
     do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
-    for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
+        for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
     } while (0)
 
 /* Check if substring matches at given offset.  the offset must be
index ee67c706ec6800d4c3f086c66a38623f93130dd8..f05090f28d0a81723951a0e21872c9db79c04538 100644 (file)
@@ -83,7 +83,6 @@ extern int _OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *);
 */
 PyObject *CFRange_New(CFRange *itself)
 {
-
     return Py_BuildValue("ll", (long)itself->location, (long)itself->length);
 }
 
@@ -104,8 +103,8 @@ int
 OptionalCFURLRefObj_Convert(PyObject *v, CFURLRef *p_itself)
 {
     if ( v == Py_None ) {
-    p_itself = NULL;
-    return 1;
+        p_itself = NULL;
+        return 1;
     }
     return CFURLRefObj_Convert(v, p_itself);
 }
index e06a25f2d361bb5161ba00307f7364ab6f4d46df..5499958d3ef341f6c4b9323738e2de5b95ba18c2 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 14d1cea5b0b23bc783b25b94eca93f528cd34242..e524c23ff417e3327fe28a07a6f837a216e99208 100644 (file)
@@ -8,9 +8,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 855ff542fc48666533d70067dc17853d5de4e1da..c3cfb917d116d76c87ab88914947c5dc8602a4d7 100644 (file)
@@ -8,9 +8,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index bd61efab5a8eeeb3e2a864a1e1cc9f2c199ee473..7a0f5f859610b0fd7d87ff43537183a306341e5f 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index eb5b16de2d9c181f100fdc60741239f28720aad3..808b5a00c6637d487b7e5b0325178f98be2519e9 100644 (file)
@@ -13,9 +13,9 @@ typedef SInt16  FSIORefNum;
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index c516f2467cfc1c61a7f5d76af40056c9074b7c94..a247e4167d0377b3a79e990c9d8f699e02757acd 100644 (file)
@@ -11,9 +11,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 10597f5e28cae49ef4d4092dadca2a978f4ddb34..cfd2625dfa4a353f27c6eda2b4b86951b5d92f31 100644 (file)
@@ -9,9 +9,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 4d25c9ea618ed8fcb6768d2c9b1e3d7a5a57b68a..69e2a966ace6b4e643c4656d0246b81c1089839c 100644 (file)
@@ -8,9 +8,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 88e20646e30d2ac468d34f3be290872388dfdfc7..83e5f58f93a1df0f6339e467c707f33853600663 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 88912b2b70fb194a22b494773cdaa9ae8bbab1b9..6e94ae0d4e78a9a5d9797fc5c94955c6adaa52ae 100644 (file)
@@ -9,9 +9,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 811045ec6fbacf4aea86476f3c0d4e3dfd65d2c2..2cf2f5012d6492bdd22e332b3bd61aafaa56622c 100644 (file)
@@ -9,9 +9,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index dbb075c1d2d6c60aa66bc3e4a8c252996b5f350a..f0a2b58ce5b0d190afb3afbbf663bd0f98b2b2f0 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 759d1bcc1e85e9bd67716e4c8ff898451f5b7e93..62d41112739aa17871614849b18adb65bcfcd4a0 100644 (file)
@@ -9,9 +9,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 10dd0ff05e76dc7c11e974875813bc108f1805e2..b3e6b81d693659f2a88950d27c2d3e5d8e75bb38 100644 (file)
@@ -9,9 +9,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index d21f36100f770c884c08d55203a35dc342f7737d..2f036fdca0429215537dd6897de3e8bb340d0134 100644 (file)
@@ -11,9 +11,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index e5562cb72ff4d32e6265d822ed0ab8a55cc51a57..76ce5fcbcfcfd474755577880525cb68b877c6e8 100644 (file)
@@ -11,9 +11,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 393b025d77ed271aa71bb917919c2997e88ce4df..b6fb602e7443b72bb2274d0ad21f974bad6d81dd 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 7f545860b3d8e711e59ab0ae5d4459368d641da0..b1410ab476957eeba51b6a288d3a7bc0aa90976e 100644 (file)
@@ -8,9 +8,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index f24ed8bb08bbe9881502e2ac4a7a52ae55a69edc..5bd1ba78c220adef619175debb56b0a53fc67db5 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index d713efe13c03f7da421bae4524152b88665c6cd0..32337a20e7d900a93d1ff4e69a2c0d85acaf27ab 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index c3018e8144db3ba96db86ab1088539557e32acfc..78b027d99c26cd67f43ad467c5eada4afd2decdb 100644 (file)
@@ -10,9 +10,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index 6eca86e3612e0386ff7fc36ca99e9d3b9b7819a8..4c6207fdbb3dfe5dfdcb6b94188a27b5def8988b 100644 (file)
@@ -9,9 +9,9 @@
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
-    PyErr_SetString(PyExc_NotImplementedError, \
-    "Not available in this shared library/OS version"); \
-    return NULL; \
+        PyErr_SetString(PyExc_NotImplementedError, \
+            "Not available in this shared library/OS version"); \
+        return NULL; \
     }} while(0)
 
 
index a1c0be895be0dee754928073b1eb18580d9cf9e7..5b4ac47a3ba28e323afcfee908de032eb4f96737 100644 (file)
@@ -5396,11 +5396,11 @@ comerror_init(PyObject *self, PyObject *args)
 
     a = PySequence_GetSlice(args, 1, PySequence_Size(args));
     if (!a)
-    return NULL;
+        return NULL;
     status = PyObject_SetAttrString(self, "args", a);
     Py_DECREF(a);
     if (status < 0)
-    return NULL;
+        return NULL;
 
     if (PyObject_SetAttrString(self, "hresult", hresult) < 0)
         return NULL;
@@ -5755,25 +5755,25 @@ PyObject *My_PyUnicode_FromWideChar(register const wchar_t *w,
     PyUnicodeObject *unicode;
 
     if (w == NULL) {
-    PyErr_BadInternalCall();
-    return NULL;
+        PyErr_BadInternalCall();
+        return NULL;
     }
 
     unicode = (PyUnicodeObject *)PyUnicode_FromUnicode(NULL, size);
     if (!unicode)
-    return NULL;
+        return NULL;
 
     /* Copy the wchar_t data into the new object */
 #ifdef HAVE_USABLE_WCHAR_T
     memcpy(unicode->str, w, size * sizeof(wchar_t));
 #else
     {
-    register Py_UNICODE *u;
-    register int i;
-    u = PyUnicode_AS_UNICODE(unicode);
-    /* In Python, the following line has a one-off error */
-    for (i = size; i > 0; i--)
-        *u++ = *w++;
+        register Py_UNICODE *u;
+        register int i;
+        u = PyUnicode_AS_UNICODE(unicode);
+        /* In Python, the following line has a one-off error */
+        for (i = size; i > 0; i--)
+            *u++ = *w++;
     }
 #endif
 
@@ -5785,21 +5785,21 @@ Py_ssize_t My_PyUnicode_AsWideChar(PyUnicodeObject *unicode,
                             Py_ssize_t size)
 {
     if (unicode == NULL) {
-    PyErr_BadInternalCall();
-    return -1;
+        PyErr_BadInternalCall();
+        return -1;
     }
     if (size > PyUnicode_GET_SIZE(unicode))
-    size = PyUnicode_GET_SIZE(unicode);
+        size = PyUnicode_GET_SIZE(unicode);
 #ifdef HAVE_USABLE_WCHAR_T
     memcpy(w, unicode->str, size * sizeof(wchar_t));
 #else
     {
-    register Py_UNICODE *u;
-    register int i;
-    u = PyUnicode_AS_UNICODE(unicode);
-    /* In Python, the following line has a one-off error */
-    for (i = size; i > 0; i--)
-        *w++ = *u++;
+        register Py_UNICODE *u;
+        register int i;
+        u = PyUnicode_AS_UNICODE(unicode);
+        /* In Python, the following line has a one-off error */
+        for (i = size; i > 0; i--)
+            *w++ = *u++;
     }
 #endif
 
index e497a8faeef95646935344bd0a1ed993c7050807..7e2f1a997be68fcb5489e3381b4869ceb0b6c1dc 100644 (file)
@@ -57,9 +57,10 @@ copy_grouping(char* s)
     int i;
     PyObject *result, *val = NULL;
 
-    if (s[0] == '\0')
-    /* empty string: no grouping at all */
-    return PyList_New(0);
+    if (s[0] == '\0') {
+        /* empty string: no grouping at all */
+        return PyList_New(0);
+    }
 
     for (i = 0; s[i] != '\0' && s[i] != CHAR_MAX; i++)
         ; /* nothing */
@@ -534,7 +535,7 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
 {
     int item, i;
     if (!PyArg_ParseTuple(args, "i:nl_langinfo", &item))
-    return NULL;
+        return NULL;
     /* Check whether this is a supported constant. GNU libc sometimes
        returns numeric values in the char* return value, which would
        crash PyString_FromString.  */
index 1d97bd4e985789142f255d18f70633f6540271ed..12e6eee44c2daa47e36a606bace967021ad41f60 100644 (file)
 
 #define CHECK_READABLE(self) \
     if (!(self->flags & READABLE)) { \
-    PyErr_SetString(PyExc_IOError, "connection is write-only"); \
-    return NULL; \
+        PyErr_SetString(PyExc_IOError, "connection is write-only"); \
+        return NULL; \
     }
 
 #define CHECK_WRITABLE(self) \
     if (!(self->flags & WRITABLE)) { \
-    PyErr_SetString(PyExc_IOError, "connection is read-only"); \
-    return NULL; \
+        PyErr_SetString(PyExc_IOError, "connection is read-only"); \
+        return NULL; \
     }
 
 /*
index dce511db11c1fa6b09391dae6cdac005ba4e7d78..06af60f587e980c6d4ffe309879a57708de2e435 100644 (file)
@@ -880,7 +880,7 @@ binascii_crc32(PyObject *self, PyObject *args)
     int signed_val;
 
     if (!PyArg_ParseTuple(args, "s*|I:crc32", &pbuf, &crc32val))
-    return NULL;
+        return NULL;
     /* In Python 2.x we return a signed integer regardless of native platform
      * long size (the 32bit unsigned long is treated as 32-bit signed and sign
      * extended into a 64-bit long inside the integer object).  3.0 does the
index 578cf3df069196890b071913782c424627bc486d..478d75dbbede0ca5ce3619786b52f6134c5f5996 100644 (file)
@@ -851,7 +851,7 @@ initbsddb185(void) {
 
     if (PyErr_WarnPy3k("the bsddb185 module has been removed in "
                        "Python 3.0", 2) < 0)
-    return;
+        return;
 
     Bsddbtype.ob_type = &PyType_Type;
     m = Py_InitModule("bsddb185", bsddbmodule_methods);
index 88f4f23d82ecbfeceece4a9d08ca235b7f1b3200..845ad8f6a515cb21726d08e1f9e3fd8f170f2c01 100644 (file)
@@ -1323,71 +1323,71 @@ modified_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size)
 #endif
 
     if (size > PY_SSIZE_T_MAX / expandsize)
-    return PyErr_NoMemory();
+        return PyErr_NoMemory();
 
     repr = PyString_FromStringAndSize(NULL, expandsize * size);
     if (repr == NULL)
-    return NULL;
+        return NULL;
     if (size == 0)
-    return repr;
+        return repr;
 
     p = q = PyString_AS_STRING(repr);
     while (size-- > 0) {
-    Py_UNICODE ch = *s++;
+        Py_UNICODE ch = *s++;
 #ifdef Py_UNICODE_WIDE
-    /* Map 32-bit characters to '\Uxxxxxxxx' */
-    if (ch >= 0x10000) {
-        *p++ = '\\';
-        *p++ = 'U';
-        *p++ = hexdigit[(ch >> 28) & 0xf];
-        *p++ = hexdigit[(ch >> 24) & 0xf];
-        *p++ = hexdigit[(ch >> 20) & 0xf];
-        *p++ = hexdigit[(ch >> 16) & 0xf];
-        *p++ = hexdigit[(ch >> 12) & 0xf];
-        *p++ = hexdigit[(ch >> 8) & 0xf];
-        *p++ = hexdigit[(ch >> 4) & 0xf];
-        *p++ = hexdigit[ch & 15];
-    }
-    else
+        /* Map 32-bit characters to '\Uxxxxxxxx' */
+        if (ch >= 0x10000) {
+            *p++ = '\\';
+            *p++ = 'U';
+            *p++ = hexdigit[(ch >> 28) & 0xf];
+            *p++ = hexdigit[(ch >> 24) & 0xf];
+            *p++ = hexdigit[(ch >> 20) & 0xf];
+            *p++ = hexdigit[(ch >> 16) & 0xf];
+            *p++ = hexdigit[(ch >> 12) & 0xf];
+            *p++ = hexdigit[(ch >> 8) & 0xf];
+            *p++ = hexdigit[(ch >> 4) & 0xf];
+            *p++ = hexdigit[ch & 15];
+        }
+        else
 #else
-    /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */
-    if (ch >= 0xD800 && ch < 0xDC00) {
-        Py_UNICODE ch2;
-        Py_UCS4 ucs;
-
-        ch2 = *s++;
-        size--;
-        if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
-        ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
-        *p++ = '\\';
-        *p++ = 'U';
-        *p++ = hexdigit[(ucs >> 28) & 0xf];
-        *p++ = hexdigit[(ucs >> 24) & 0xf];
-        *p++ = hexdigit[(ucs >> 20) & 0xf];
-        *p++ = hexdigit[(ucs >> 16) & 0xf];
-        *p++ = hexdigit[(ucs >> 12) & 0xf];
-        *p++ = hexdigit[(ucs >> 8) & 0xf];
-        *p++ = hexdigit[(ucs >> 4) & 0xf];
-        *p++ = hexdigit[ucs & 0xf];
-        continue;
-        }
-        /* Fall through: isolated surrogates are copied as-is */
-        s--;
-        size++;
-    }
+        /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */
+        if (ch >= 0xD800 && ch < 0xDC00) {
+            Py_UNICODE ch2;
+            Py_UCS4 ucs;
+
+            ch2 = *s++;
+            size--;
+            if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+                ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
+                *p++ = '\\';
+                *p++ = 'U';
+                *p++ = hexdigit[(ucs >> 28) & 0xf];
+                *p++ = hexdigit[(ucs >> 24) & 0xf];
+                *p++ = hexdigit[(ucs >> 20) & 0xf];
+                *p++ = hexdigit[(ucs >> 16) & 0xf];
+                *p++ = hexdigit[(ucs >> 12) & 0xf];
+                *p++ = hexdigit[(ucs >> 8) & 0xf];
+                *p++ = hexdigit[(ucs >> 4) & 0xf];
+                *p++ = hexdigit[ucs & 0xf];
+                continue;
+            }
+            /* Fall through: isolated surrogates are copied as-is */
+            s--;
+            size++;
+        }
 #endif
-    /* Map 16-bit characters to '\uxxxx' */
-    if (ch >= 256 || ch == '\\' || ch == '\n') {
-        *p++ = '\\';
-        *p++ = 'u';
-        *p++ = hexdigit[(ch >> 12) & 0xf];
-        *p++ = hexdigit[(ch >> 8) & 0xf];
-        *p++ = hexdigit[(ch >> 4) & 0xf];
-        *p++ = hexdigit[ch & 15];
-    }
-    /* Copy everything else as-is */
-    else
-        *p++ = (char) ch;
+        /* Map 16-bit characters to '\uxxxx' */
+        if (ch >= 256 || ch == '\\' || ch == '\n') {
+            *p++ = '\\';
+            *p++ = 'u';
+            *p++ = hexdigit[(ch >> 12) & 0xf];
+            *p++ = hexdigit[(ch >> 8) & 0xf];
+            *p++ = hexdigit[(ch >> 4) & 0xf];
+            *p++ = hexdigit[ch & 15];
+        }
+        /* Copy everything else as-is */
+        else
+            *p++ = (char) ch;
     }
     *p = '\0';
     _PyString_Resize(&repr, p - q);
index 5b78789d5af903b9b8aceb62bdd20667ef6a8254..ce62f406462732dae1b8ec3c6dc0066995a2c9a0 100644 (file)
@@ -496,17 +496,17 @@ O_writelines(Oobject *self, PyObject *args) {
             Py_DECREF(it);
             Py_DECREF(s);
             return NULL;
-           }
-           Py_DECREF(s);
-       }
+        }
+        Py_DECREF(s);
+    }
 
-       Py_DECREF(it);
+    Py_DECREF(it);
 
-       /* See if PyIter_Next failed */
-       if (PyErr_Occurred())
-           return NULL;
+    /* See if PyIter_Next failed */
+    if (PyErr_Occurred())
+        return NULL;
 
-       Py_RETURN_NONE;
+    Py_RETURN_NONE;
 }
 static struct PyMethodDef O_methods[] = {
   /* Common methods: */
index e5d568f204db9d185aaf183b89efb610c555f0d8..2179bcddf17bbd74badad50ead8118b815f313dc 100644 (file)
@@ -964,7 +964,7 @@ initcl(void)
 
     if (PyErr_WarnPy3k("the cl module has been removed in "
                        "Python 3.0", 2) < 0)
-    return;
+        return;
 
     m = Py_InitModule("cl", cl_methods);
     if (m == NULL)
index c349ad076a3a49e390e2a6fbf212290332df13d5..dfecf9d33bdaf17ef51e3d5d81c859df715f9227 100644 (file)
@@ -240,7 +240,7 @@ initdl(void)
 
     if (PyErr_WarnPy3k("the dl module has been removed in "
                         "Python 3.0; use the ctypes module instead", 2) < 0)
-    return;
+        return;
 
     /* Initialize object type */
     Py_TYPE(&Dltype) = &PyType_Type;
index 9d8b58782730a75425f1417cecf23d4df778fedb..988d942bf88ec74aa1498481ef3a9839583a2473 100644 (file)
@@ -21,7 +21,7 @@ conv_descriptor(PyObject *object, int *target)
     int fd = PyObject_AsFileDescriptor(object);
 
     if (fd < 0)
-    return 0;
+        return 0;
     *target = fd;
     return 1;
 }
index 0ddf6006e277d3a1c04ab022c15049d22e080dfb..a21489e44a758562beeff721362919aef6e5a876 100644 (file)
@@ -151,9 +151,9 @@ generic_set_call_back(genericobject *g, PyObject *args)
         g->ob_callback_arg = NULL;
     }
     else {
-    PyObject *a, *b;
-    if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b))
-        return NULL;
+        PyObject *a, *b;
+        if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b))
+            return NULL;
         Py_XDECREF(g->ob_callback);
         Py_XDECREF(g->ob_callback_arg);
         g->ob_callback = a;
@@ -2124,10 +2124,9 @@ static PyMethodDef forms_methods[] = {
 PyMODINIT_FUNC
 initfl(void)
 {
-
     if (PyErr_WarnPy3k("the fl module has been removed in "
                        "Python 3.0", 2) < 0)
-    return;
+        return;
 
     Py_InitModule("fl", forms_methods);
     if (m == NULL)
index 3a741070c0b2813715bc0b23ee17105ad44481cc..bf3b330f20f6fe4113023a99e396027d123b3607 100644 (file)
@@ -257,10 +257,9 @@ static PyMethodDef fm_methods[] = {
 void
 initfm(void)
 {
-
     if (PyErr_WarnPy3k("the fm module has been removed in "
                        "Python 3.0", 2) < 0)
-    return;
+        return;
 
     Py_InitModule("fm", fm_methods);
     if (m == NULL)
index b9c64fb33e9c683e205bb15e74fa662dd5ad3b1a..9609378b385460a5e390321b5307a6952e8cd3fe 100644 (file)
@@ -7624,10 +7624,9 @@ static struct PyMethodDef gl_methods[] = {
 void
 initgl(void)
 {
-
     if (PyErr_WarnPy3k("the gl module has been removed in "
                        "Python 3.0", 2) < 0)
-    return;
+        return;
 
     (void) Py_InitModule("gl", gl_methods);
 }
index ef9b24508ca22fba776e3e98ca24f29c26cd9f7f..44217c67ca8a4bfeb3f806b039d4b2d7689b340d 100644 (file)
@@ -153,15 +153,15 @@ static void RunStartupFile(PyCompilerFlags *cf)
             (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
             PyErr_Clear();
             fclose(fp);
-           } else {
-                    int save_errno;
-                    save_errno = errno;
-                    PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
-                    errno = save_errno;
-                    PyErr_SetFromErrnoWithFilename(PyExc_IOError,
-                                                   startup);
-                    PyErr_Print();
-                    PyErr_Clear();
+        } else {
+            int save_errno;
+            save_errno = errno;
+            PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
+            errno = save_errno;
+            PyErr_SetFromErrnoWithFilename(PyExc_IOError,
+                                           startup);
+            PyErr_Print();
+            PyErr_Clear();
         }
     }
 }
index c0e17f3a2e5625d3b0bde4b745a1e4da2e80e1bf..1d7ba4ba48af95a82daa4da4b83836baa5084c6c 100644 (file)
@@ -126,18 +126,18 @@ itimer_retval(struct itimerval *iv)
 
     r = PyTuple_New(2);
     if (r == NULL)
-    return NULL;
+        return NULL;
 
     if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_value)))) {
-    Py_DECREF(r);
-    return NULL;
+        Py_DECREF(r);
+        return NULL;
     }
 
     PyTuple_SET_ITEM(r, 0, v);
 
     if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_interval)))) {
-    Py_DECREF(r);
-    return NULL;
+        Py_DECREF(r);
+        return NULL;
     }
 
     PyTuple_SET_ITEM(r, 1, v);
@@ -455,14 +455,14 @@ signal_setitimer(PyObject *self, PyObject *args)
     struct itimerval new, old;
 
     if(!PyArg_ParseTuple(args, "id|d:setitimer", &which, &first, &interval))
-    return NULL;
+        return NULL;
 
     timeval_from_double(first, &new.it_value);
     timeval_from_double(interval, &new.it_interval);
     /* Let OS check "which" value */
     if (setitimer(which, &new, &old) != 0) {
-    PyErr_SetFromErrno(ItimerError);
-    return NULL;
+        PyErr_SetFromErrno(ItimerError);
+        return NULL;
     }
 
     return itimer_retval(&old);
@@ -488,11 +488,11 @@ signal_getitimer(PyObject *self, PyObject *args)
     struct itimerval old;
 
     if (!PyArg_ParseTuple(args, "i:getitimer", &which))
-    return NULL;
+        return NULL;
 
     if (getitimer(which, &old) != 0) {
-    PyErr_SetFromErrno(ItimerError);
-    return NULL;
+        PyErr_SetFromErrno(ItimerError);
+        return NULL;
     }
 
     return itimer_retval(&old);
@@ -834,9 +834,9 @@ initsignal(void)
 
 #if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
     ItimerError = PyErr_NewException("signal.ItimerError",
-     PyExc_IOError, NULL);
+            PyExc_IOError, NULL);
     if (ItimerError != NULL)
-    PyDict_SetItemString(d, "ItimerError", ItimerError);
+        PyDict_SetItemString(d, "ItimerError", ItimerError);
 #endif
 
 #ifdef CTRL_C_EVENT
index 9c5fa54b89ae0dae18a6f6df539adc80a1573eaa..c046178fb4b5180163d9330dbd691cb55cf88ff9 100644 (file)
@@ -1637,12 +1637,13 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
         return 1;
     }
 #endif /* AF_UNIX */
+
 #if defined(AF_NETLINK)
-       case AF_NETLINK:
-       {
-           *len_ret = sizeof (struct sockaddr_nl);
-           return 1;
-       }
+    case AF_NETLINK:
+    {
+        *len_ret = sizeof (struct sockaddr_nl);
+        return 1;
+    }
 #endif
 
     case AF_INET:
index a4e2c7eb17cb815e8165db4c24a47807f767e178..c19dafd8d20f73abd757bfa83cba54f29be122d1 100644 (file)
@@ -56,7 +56,7 @@ PyMODINIT_FUNC inittiming(void)
 {
     if (PyErr_WarnPy3k("the timing module has been removed in "
                         "Python 3.0; use time.clock() instead", 2) < 0)
-    return;
+        return;
 
     (void)Py_InitModule("timing", timing_methods);
 }
index c4e3895eadb59a20ed192cec9deaf0ba7e68cfc7..ef18e3fea200e5dd247a9fa91224e0846a9188ff 100644 (file)
@@ -495,20 +495,20 @@ to_complex(PyObject **pobj, Py_complex *pc)
 
     pc->real = pc->imag = 0.0;
     if (PyInt_Check(obj)) {
-    pc->real = PyInt_AS_LONG(obj);
-    return 0;
+        pc->real = PyInt_AS_LONG(obj);
+        return 0;
     }
     if (PyLong_Check(obj)) {
-    pc->real = PyLong_AsDouble(obj);
-    if (pc->real == -1.0 && PyErr_Occurred()) {
-        *pobj = NULL;
-        return -1;
-    }
-    return 0;
+        pc->real = PyLong_AsDouble(obj);
+        if (pc->real == -1.0 && PyErr_Occurred()) {
+            *pobj = NULL;
+            return -1;
+        }
+        return 0;
     }
     if (PyFloat_Check(obj)) {
-    pc->real = PyFloat_AsDouble(obj);
-    return 0;
+        pc->real = PyFloat_AsDouble(obj);
+        return 0;
     }
     Py_INCREF(Py_NotImplemented);
     *pobj = Py_NotImplemented;
@@ -909,25 +909,25 @@ complex__format__(PyObject* self, PyObject* args)
     PyObject *format_spec;
 
     if (!PyArg_ParseTuple(args, "O:__format__", &format_spec))
-    return NULL;
+        return NULL;
     if (PyBytes_Check(format_spec))
-    return _PyComplex_FormatAdvanced(self,
-                                     PyBytes_AS_STRING(format_spec),
-                                     PyBytes_GET_SIZE(format_spec));
+        return _PyComplex_FormatAdvanced(self,
+                                         PyBytes_AS_STRING(format_spec),
+                                         PyBytes_GET_SIZE(format_spec));
     if (PyUnicode_Check(format_spec)) {
-    /* Convert format_spec to a str */
-    PyObject *result;
-    PyObject *str_spec = PyObject_Str(format_spec);
+        /* Convert format_spec to a str */
+        PyObject *result;
+        PyObject *str_spec = PyObject_Str(format_spec);
 
-    if (str_spec == NULL)
-        return NULL;
+        if (str_spec == NULL)
+            return NULL;
 
-    result = _PyComplex_FormatAdvanced(self,
-                                       PyBytes_AS_STRING(str_spec),
-                                       PyBytes_GET_SIZE(str_spec));
+        result = _PyComplex_FormatAdvanced(self,
+                                           PyBytes_AS_STRING(str_spec),
+                                           PyBytes_GET_SIZE(str_spec));
 
-    Py_DECREF(str_spec);
-    return result;
+        Py_DECREF(str_spec);
+        return result;
     }
     PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode");
     return NULL;
index 0e76a446afc92a5aaeeb4752e8865f6ffd520a75..c62de9c3b76f762770d5758fe59be955bf359934 100644 (file)
@@ -590,8 +590,9 @@ PyTypeObject PyFunction_Type = {
    To declare a class method, use this idiom:
 
      class C:
-     def f(cls, arg1, arg2, ...): ...
-     f = classmethod(f)
+         @classmethod
+         def f(cls, arg1, arg2, ...):
+             ...
 
    It can be called either on the class (e.g. C.f()) or on an instance
    (e.g. C().f()); the instance is ignored except for its class.
@@ -676,8 +677,9 @@ just like an instance method receives the instance.\n\
 To declare a class method, use this idiom:\n\
 \n\
   class C:\n\
-      def f(cls, arg1, arg2, ...): ...\n\
-      f = classmethod(f)\n\
+      @classmethod\n\
+      def f(cls, arg1, arg2, ...):\n\
+          ...\n\
 \n\
 It can be called either on the class (e.g. C.f()) or on an instance\n\
 (e.g. C().f()).  The instance is ignored except for its class.\n\
@@ -748,8 +750,9 @@ PyClassMethod_New(PyObject *callable)
    To declare a static method, use this idiom:
 
      class C:
-     def f(arg1, arg2, ...): ...
-     f = staticmethod(f)
+         @staticmethod
+         def f(arg1, arg2, ...):
+             ....
 
    It can be called either on the class (e.g. C.f()) or on an instance
    (e.g. C().f()); the instance is ignored except for its class.
@@ -828,8 +831,9 @@ A static method does not receive an implicit first argument.\n\
 To declare a static method, use this idiom:\n\
 \n\
      class C:\n\
-     def f(arg1, arg2, ...): ...\n\
-     f = staticmethod(f)\n\
+         @staticmethod\n\
+         def f(arg1, arg2, ...):\n\
+             ...\n\
 \n\
 It can be called either on the class (e.g. C.f()) or on an instance\n\
 (e.g. C().f()).  The instance is ignored except for its class.\n\
index 41bb074530f17635398bd7bb7f6e236574942829..189413e102c60e37416b96dff37fb804384569ba 100644 (file)
@@ -1461,8 +1461,8 @@ _PyInt_Init(void)
     int ival;
 #if NSMALLNEGINTS + NSMALLPOSINTS > 0
     for (ival = -NSMALLNEGINTS; ival < NSMALLPOSINTS; ival++) {
-          if (!free_list && (free_list = fill_free_list()) == NULL)
-                    return 0;
+        if (!free_list && (free_list = fill_free_list()) == NULL)
+            return 0;
         /* PyObject_New is inlined */
         v = free_list;
         free_list = (PyIntObject *)Py_TYPE(v);
index 5203f409ac59073d796455d1f43a4ced5be49278..baa8deebe89149cb0954514095de2dd1bfc9f90e 100644 (file)
@@ -30,11 +30,11 @@ get_len_of_range(long lo, long hi, long step)
     ---------------------------------------------------------------*/
     assert(step != 0);
     if (step > 0 && lo < hi)
-    return 1UL + (hi - 1UL - lo) / step;
+        return 1UL + (hi - 1UL - lo) / step;
     else if (step < 0 && lo > hi)
-    return 1UL + (lo - 1UL - hi) / (0UL - step);
+        return 1UL + (lo - 1UL - hi) / (0UL - step);
     else
-    return 0UL;
+        return 0UL;
 }
 
 /* Return a stop value suitable for reconstructing the xrange from
index aa88152d04001f2b328255dc11958ca00ee40a6d..60104d57db14e08add0ca09503e7f2d3fe7b0a1d 100644 (file)
@@ -3287,8 +3287,8 @@ string_zfill(PyStringObject *self, PyObject *args)
         }
         else
             return PyString_FromStringAndSize(
-            PyString_AS_STRING(self),
-            PyString_GET_SIZE(self)
+                PyString_AS_STRING(self),
+                PyString_GET_SIZE(self)
             );
     }
 
index 6e6766f7f087b4df28a606bbef311d14b96faab9..f1cc7feed7a4df0961d47177c3dc0ae6c0f0eea8 100644 (file)
@@ -1617,16 +1617,16 @@ SelectPythonDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                     PropSheet_SetWizButtons(GetParent(hwnd),
                                             PSWIZB_BACK | PSWIZB_NEXT);
                     /* Get the python directory */
-            ivi = (InstalledVersionInfo *)
+                    ivi = (InstalledVersionInfo *)
                         SendDlgItemMessage(hwnd,
-                                                                IDC_VERSIONS_LIST,
-                                                                LB_GETITEMDATA,
-                                                                id,
-                                                                0);
-            hkey_root = ivi->hkey;
-                                strcpy(python_dir, ivi->prefix);
-                                SetDlgItemText(hwnd, IDC_PATH, python_dir);
-                                /* retrieve the python version and pythondll to use */
+                            IDC_VERSIONS_LIST,
+                            LB_GETITEMDATA,
+                            id,
+                            0);
+                    hkey_root = ivi->hkey;
+                    strcpy(python_dir, ivi->prefix);
+                    SetDlgItemText(hwnd, IDC_PATH, python_dir);
+                    /* retrieve the python version and pythondll to use */
                     result = SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
                                                  LB_GETTEXTLEN, (WPARAM)id, 0);
                     pbuf = (char *)malloc(result + 1);
index 5bc2827a89b88ab500e2cf151b5d9b62a0eb82f5..b1307d7c05fb8a42394d4539d6d50e75c06fd9ee 100644 (file)
@@ -325,18 +325,18 @@ calculate_path(void)
             pythonhome = NULL;
     }
     else {
-    char *delim;
+        char *delim;
 
         strcpy(prefix, pythonhome);
 
-    /* Extract Any Optional Trailing EXEC_PREFIX */
-    /* e.g. PYTHONHOME=<prefix>:<exec_prefix>   */
-    delim = strchr(prefix, DELIM);
-    if (delim) {
-        *delim = '\0';
-        strcpy(exec_prefix, delim+1);
-    } else
-        strcpy(exec_prefix, EXEC_PREFIX);
+        /* Extract Any Optional Trailing EXEC_PREFIX */
+        /* e.g. PYTHONHOME=<prefix>:<exec_prefix>   */
+        delim = strchr(prefix, DELIM);
+        if (delim) {
+            *delim = '\0';
+            strcpy(exec_prefix, delim+1);
+        } else
+            strcpy(exec_prefix, EXEC_PREFIX);
     }
 
     if (envpath && *envpath == '\0')
index 2977bcd77e59b47c3e977bbe0cebe52723815651..f03e48892e45a466c8c5b365b04ee4765075d46f 100644 (file)
@@ -2923,20 +2923,20 @@ filterstring(PyObject *func, PyObject *strobj)
 
                     if (need<2*outlen) {
                         need = 2*outlen;
-      }
-                                    if (_PyString_Resize(&result, need)) {
-                                            Py_DECREF(item);
-                                            return NULL;
-                                    }
-                                    outlen = need;
-                            }
-                            memcpy(
-                                    PyString_AS_STRING(result) + j,
-                                    PyString_AS_STRING(item),
-                                    reslen
-                            );
-                            j += reslen;
                     }
+                    if (_PyString_Resize(&result, need)) {
+                        Py_DECREF(item);
+                        return NULL;
+                    }
+                    outlen = need;
+                }
+                memcpy(
+                    PyString_AS_STRING(result) + j,
+                    PyString_AS_STRING(item),
+                    reslen
+                );
+                j += reslen;
+            }
         }
         Py_DECREF(item);
         if (ok < 0)
@@ -3031,29 +3031,27 @@ filterunicode(PyObject *func, PyObject *strobj)
                 assert(outlen >= 0);
 
                 if (need > outlen) {
-                    /* overallocate,
-                       to avoid reallocations */
+                    /* overallocate, to avoid reallocations */
                     if (need < 2 * outlen) {
-        if (outlen > PY_SSIZE_T_MAX / 2) {
-          Py_DECREF(item);
-          return NULL;
-                                            } else {
-                                                    need = 2 * outlen;
-                                }
-      }
-
-                                    if (PyUnicode_Resize(
-                                            &result, need) < 0) {
-                                            Py_DECREF(item);
-                                            goto Fail_1;
-                                    }
-                                    outlen = need;
-                            }
-                            memcpy(PyUnicode_AS_UNICODE(result) + j,
-                                   PyUnicode_AS_UNICODE(item),
-                                   reslen*sizeof(Py_UNICODE));
-                            j += reslen;
+                        if (outlen > PY_SSIZE_T_MAX / 2) {
+                            Py_DECREF(item);
+                            return NULL;
+                        } else {
+                            need = 2 * outlen;
+                        }
                     }
+
+                    if (PyUnicode_Resize(&result, need) < 0) {
+                        Py_DECREF(item);
+                        goto Fail_1;
+                    }
+                    outlen = need;
+                }
+                memcpy(PyUnicode_AS_UNICODE(result) + j,
+                   PyUnicode_AS_UNICODE(item),
+                   reslen*sizeof(Py_UNICODE));
+                j += reslen;
+            }
         }
         Py_DECREF(item);
         if (ok < 0)
index a38c09a4856913bac83877026995e661c6fcaa84..b91be3b7aa0fbd1d9bed8801609dcce0c9a58d0e 100644 (file)
@@ -356,11 +356,11 @@ PyObject *(*PyMacGluePtr_##routinename)(object); \
 \
 PyObject *routinename(object cobj) { \
     if (!PyMacGluePtr_##routinename) { \
-       if (!PyImport_ImportModule(module)) return NULL; \
-       if (!PyMacGluePtr_##routinename) { \
-       PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \
-       return NULL; \
-       } \
+        if (!PyImport_ImportModule(module)) return NULL; \
+        if (!PyMacGluePtr_##routinename) { \
+            PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \
+            return NULL; \
+        } \
     } \
     return (*PyMacGluePtr_##routinename)(cobj); \
 }
@@ -370,11 +370,11 @@ int (*PyMacGluePtr_##routinename)(PyObject *, object *); \
 \
 int routinename(PyObject *pyobj, object *cobj) { \
     if (!PyMacGluePtr_##routinename) { \
-       if (!PyImport_ImportModule(module)) return 0; \
-       if (!PyMacGluePtr_##routinename) { \
-       PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \
-       return 0; \
-       } \
+        if (!PyImport_ImportModule(module)) return 0; \
+        if (!PyMacGluePtr_##routinename) { \
+            PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \
+            return 0; \
+        } \
     } \
     return (*PyMacGluePtr_##routinename)(pyobj, cobj); \
 }
index b9c10da5b8499daecb0b41569f643e8efe80403c..25634b82a7082f32dbde552d12235f78651bfe75 100644 (file)
@@ -72,12 +72,12 @@ PyThread_type_lock PyThread_allocate_lock(void)
 
     dprintf(("PyThread_allocate_lock called\n"));
     if (!initialized)
-    PyThread_init_thread();
+        PyThread_init_thread();
 
     aLock = CreateEvent(NULL,           /* Security attributes      */
-            0,              /* Manual-Reset               */
+                        0,              /* Manual-Reset               */
                         1,              /* Is initially signalled  */
-            NULL);          /* Name of event            */
+                        NULL);          /* Name of event            */
 
     dprintf(("%ld: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock));
 
@@ -117,7 +117,7 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
 #endif
 
     if (waitResult != WAIT_OBJECT_0) {
-                success = 0;    /* We failed */
+        success = 0;    /* We failed */
     }
 
     dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success));
@@ -130,7 +130,7 @@ void PyThread_release_lock(PyThread_type_lock aLock)
     dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
 
     if (!SetEvent(aLock))
-    dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
+        dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
 }
 
 
index 43873832357df2dc80c3deed19b155a76149a641..1049e65cc8d82c6571f2e240a388a36de20a52d2 100644 (file)
@@ -46,7 +46,7 @@ riscos_rename(PyObject *self, PyObject *args)
 {
     char *path1, *path2;
     if (!PyArg_ParseTuple(args, "ss:rename", &path1, &path2))
-    return NULL;
+        return NULL;
     if (rename(path1,path2)) return PyErr_SetFromErrno(PyExc_OSError);
     Py_INCREF(Py_None);
     return Py_None;