99 * modify it under the terms of the GNU Lesser General Public
1010 * License as published by the Free Software Foundation; either
1111 * version 2.1 of the License, or (at your option) any later version.
12- *
12+ *
1313 * This library is distributed in the hope that it will be useful,
1414 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1515 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1616 * Lesser General Public License for more details.
17- *
17+ *
1818 * You should have received a copy of the GNU Lesser General Public
1919 * License along with this library; if not, write to the Free Software
2020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21- *
21+ *
2222 * $Id$
2323 *
2424 */
@@ -75,27 +75,27 @@ pylzma_calculate_key(PyObject *self, PyObject *args, PyObject *kwargs)
7575
7676 if (!PyArg_ParseTupleAndKeywords (args , kwargs , "s#i|Os" , kwlist , & password , & pwlen , & cycles , & pysalt , & digest ))
7777 return NULL ;
78-
78+
7979 if (pysalt == Py_None ) {
8080 pysalt = NULL ;
8181 } else if (!PyBytes_Check (pysalt )) {
8282 PyErr_Format (PyExc_TypeError , "salt must be a string, got a %s" , pysalt -> ob_type -> tp_name );
8383 return NULL ;
8484 }
85-
85+
8686 if (strcmp (digest , "sha256" ) != 0 ) {
8787 PyErr_Format (PyExc_TypeError , "digest %s is unsupported" , digest );
8888 return NULL ;
8989 }
90-
90+
9191 if (pysalt != NULL ) {
9292 salt = PyBytes_AS_STRING (pysalt );
9393 saltlen = PyBytes_Size (pysalt );
9494 } else {
9595 salt = NULL ;
9696 saltlen = 0 ;
9797 }
98-
98+
9999 if (cycles == 0x3f ) {
100100 int pos ;
101101 int i ;
@@ -124,7 +124,7 @@ pylzma_calculate_key(PyObject *self, PyObject *args, PyObject *kwargs)
124124 Sha256_Final (& sha , (Byte * ) & key );
125125 Py_END_ALLOW_THREADS
126126 }
127-
127+
128128 return PyBytes_FromStringAndSize (key , 32 );
129129}
130130
@@ -139,15 +139,15 @@ pylzma_bcj_x86_convert(PyObject *self, PyObject *args)
139139 PARSE_LENGTH_TYPE length ;
140140 int encoding = 0 ;
141141 PyObject * result ;
142-
142+
143143 if (!PyArg_ParseTuple (args , "s#|i" , & data , & length , & encoding )) {
144144 return NULL ;
145145 }
146-
146+
147147 if (!length ) {
148148 return PyBytes_FromString ("" );
149149 }
150-
150+
151151 result = PyBytes_FromStringAndSize (data , length );
152152 if (result != NULL ) {
153153 UInt32 state ;
@@ -156,7 +156,7 @@ pylzma_bcj_x86_convert(PyObject *self, PyObject *args)
156156 x86_Convert ((Byte * ) PyBytes_AS_STRING (result ), length , 0 , & state , encoding );
157157 Py_END_ALLOW_THREADS
158158 }
159-
159+
160160 return result ;
161161}
162162
@@ -564,7 +564,7 @@ initpylzma(void)
564564#if 0
565565 Py_INCREF (& CCompressionObject_Type );
566566 PyModule_AddObject (m , "compressobj" , (PyObject * )& CCompressionObject_Type );
567- #endif
567+ #endif
568568 Py_INCREF (& CCompressionFileObject_Type );
569569 PyModule_AddObject (m , "compressfile" , (PyObject * )& CCompressionFileObject_Type );
570570
@@ -589,7 +589,9 @@ initpylzma(void)
589589 pylzma_init_compfile ();
590590
591591#if defined(WITH_THREAD )
592+ #if PY_VERSION_HEX < 0x03090000
592593 PyEval_InitThreads ();
594+ #endif
593595
594596#if !defined(PYLZMA_USE_GILSTATE )
595597 /* Save the current interpreter, so compressing file objects works. */
0 commit comments