073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.228
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.228
073263
Problem:    Compiler warnings when building with Python 3.2.
073263
Solution:   Make type cast depend on Python version. (Ken Takata)
073263
Files:	    src/if_py_both.h, src/if_python.c, src/if_python3.c
073263
073263
073263
*** ../vim-7.4.227/src/if_py_both.h	2014-03-08 16:13:39.115462069 +0100
073263
--- src/if_py_both.h	2014-03-30 15:58:40.948518929 +0200
073263
***************
073263
*** 2328,2334 ****
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject *)idx, ListLength(self),
073263
  				 &start, &stop, &step, &slicelen) < 0)
073263
  	    return NULL;
073263
  	return ListSlice(self, start, step, slicelen);
073263
--- 2328,2334 ----
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject_T *)idx, ListLength(self),
073263
  				 &start, &stop, &step, &slicelen) < 0)
073263
  	    return NULL;
073263
  	return ListSlice(self, start, step, slicelen);
073263
***************
073263
*** 2618,2624 ****
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject *)idx, ListLength(self),
073263
  				 &start, &stop, &step, &slicelen) < 0)
073263
  	    return -1;
073263
  	return ListAssSlice(self, start, step, slicelen,
073263
--- 2618,2624 ----
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject_T *)idx, ListLength(self),
073263
  				 &start, &stop, &step, &slicelen) < 0)
073263
  	    return -1;
073263
  	return ListAssSlice(self, start, step, slicelen,
073263
*** ../vim-7.4.227/src/if_python.c	2014-02-23 22:52:33.368764715 +0100
073263
--- src/if_python.c	2014-03-30 15:58:35.768518850 +0200
073263
***************
073263
*** 803,808 ****
073263
--- 803,810 ----
073263
  # define PY_STRSAVE(s) ((char_u *) py_memsave(s, STRLEN(s) + 1))
073263
  #endif
073263
  
073263
+ typedef PySliceObject PySliceObject_T;
073263
+ 
073263
  /*
073263
   * Include the code shared with if_python3.c
073263
   */
073263
*** ../vim-7.4.227/src/if_python3.c	2014-01-14 19:35:49.000000000 +0100
073263
--- src/if_python3.c	2014-03-30 15:59:24.752519600 +0200
073263
***************
073263
*** 100,105 ****
073263
--- 100,115 ----
073263
  #define PyIntArgFunc	ssizeargfunc
073263
  #define PyIntObjArgProc	ssizeobjargproc
073263
  
073263
+ /*
073263
+  * PySlice_GetIndicesEx(): first argument type changed from PySliceObject
073263
+  * to PyObject in Python 3.2 or later.
073263
+  */
073263
+ #if PY_VERSION_HEX >= 0x030200f0
073263
+ typedef PyObject PySliceObject_T;
073263
+ #else
073263
+ typedef PySliceObject PySliceObject_T;
073263
+ #endif
073263
+ 
073263
  #if defined(DYNAMIC_PYTHON3) || defined(PROTO)
073263
  
073263
  # ifndef WIN3264
073263
***************
073263
*** 294,300 ****
073263
  static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
073263
  static int (*py3_PyMapping_Check)(PyObject *);
073263
  static PyObject* (*py3_PyMapping_Keys)(PyObject *);
073263
! static int (*py3_PySlice_GetIndicesEx)(PySliceObject *r, Py_ssize_t length,
073263
  		     Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
073263
  		     Py_ssize_t *slicelen);
073263
  static PyObject* (*py3_PyErr_NoMemory)(void);
073263
--- 304,310 ----
073263
  static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
073263
  static int (*py3_PyMapping_Check)(PyObject *);
073263
  static PyObject* (*py3_PyMapping_Keys)(PyObject *);
073263
! static int (*py3_PySlice_GetIndicesEx)(PySliceObject_T *r, Py_ssize_t length,
073263
  		     Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
073263
  		     Py_ssize_t *slicelen);
073263
  static PyObject* (*py3_PyErr_NoMemory)(void);
073263
***************
073263
*** 1190,1196 ****
073263
  	if (CheckBuffer((BufferObject *) self))
073263
  	    return NULL;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject *)idx,
073263
  	      (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
073263
  	      &start, &stop,
073263
  	      &step, &slicelen) < 0)
073263
--- 1200,1206 ----
073263
  	if (CheckBuffer((BufferObject *) self))
073263
  	    return NULL;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject_T *)idx,
073263
  	      (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
073263
  	      &start, &stop,
073263
  	      &step, &slicelen) < 0)
073263
***************
073263
*** 1222,1228 ****
073263
  	if (CheckBuffer((BufferObject *) self))
073263
  	    return -1;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject *)idx,
073263
  	      (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
073263
  	      &start, &stop,
073263
  	      &step, &slicelen) < 0)
073263
--- 1232,1238 ----
073263
  	if (CheckBuffer((BufferObject *) self))
073263
  	    return -1;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject_T *)idx,
073263
  	      (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
073263
  	      &start, &stop,
073263
  	      &step, &slicelen) < 0)
073263
***************
073263
*** 1306,1312 ****
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject *)idx,
073263
  		((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
073263
  		&start, &stop,
073263
  		&step, &slicelen) < 0)
073263
--- 1316,1322 ----
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject_T *)idx,
073263
  		((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
073263
  		&start, &stop,
073263
  		&step, &slicelen) < 0)
073263
***************
073263
*** 1333,1339 ****
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject *)idx,
073263
  		((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
073263
  		&start, &stop,
073263
  		&step, &slicelen) < 0)
073263
--- 1343,1349 ----
073263
      {
073263
  	Py_ssize_t start, stop, step, slicelen;
073263
  
073263
! 	if (PySlice_GetIndicesEx((PySliceObject_T *)idx,
073263
  		((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
073263
  		&start, &stop,
073263
  		&step, &slicelen) < 0)
073263
*** ../vim-7.4.227/src/version.c	2014-03-28 21:58:17.878256914 +0100
073263
--- src/version.c	2014-03-30 15:52:27.784513211 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     228,
073263
  /**/
073263
073263
-- 
073263
The average life of an organization chart is six months.  You can safely
073263
ignore any order from your boss that would take six months to complete.
073263
				(Scott Adams - The Dilbert principle)
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///