Karsten Hopp 2c69c3
To: vim_dev@googlegroups.com
Karsten Hopp 2c69c3
Subject: Patch 7.3.688
Karsten Hopp 2c69c3
Fcc: outbox
Karsten Hopp 2c69c3
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 2c69c3
Mime-Version: 1.0
Karsten Hopp 2c69c3
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 2c69c3
Content-Transfer-Encoding: 8bit
Karsten Hopp 2c69c3
------------
Karsten Hopp 2c69c3
Karsten Hopp 2c69c3
Patch 7.3.688
Karsten Hopp 2c69c3
Problem:    Python 3.3 is not supported.
Karsten Hopp 2c69c3
Solution:   Add Python 3.3 support (Ken Takata)
Karsten Hopp 2c69c3
Files:      src/if_python3.c
Karsten Hopp 2c69c3
Karsten Hopp 2c69c3
Karsten Hopp 2c69c3
*** ../vim-7.3.687/src/if_python3.c	2012-09-21 14:00:05.000000000 +0200
Karsten Hopp 2c69c3
--- src/if_python3.c	2012-10-14 03:19:53.000000000 +0200
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 174,180 ****
Karsten Hopp 2c69c3
  # define _PyObject_NextNotImplemented (*py3__PyObject_NextNotImplemented)
Karsten Hopp 2c69c3
  # define PyModule_AddObject py3_PyModule_AddObject
Karsten Hopp 2c69c3
  # define PyImport_AppendInittab py3_PyImport_AppendInittab
Karsten Hopp 2c69c3
! # define _PyUnicode_AsString py3__PyUnicode_AsString
Karsten Hopp 2c69c3
  # undef PyUnicode_AsEncodedString
Karsten Hopp 2c69c3
  # define PyUnicode_AsEncodedString py3_PyUnicode_AsEncodedString
Karsten Hopp 2c69c3
  # undef PyBytes_AsString
Karsten Hopp 2c69c3
--- 174,185 ----
Karsten Hopp 2c69c3
  # define _PyObject_NextNotImplemented (*py3__PyObject_NextNotImplemented)
Karsten Hopp 2c69c3
  # define PyModule_AddObject py3_PyModule_AddObject
Karsten Hopp 2c69c3
  # define PyImport_AppendInittab py3_PyImport_AppendInittab
Karsten Hopp 2c69c3
! # if PY_VERSION_HEX >= 0x030300f0
Karsten Hopp 2c69c3
! #  undef _PyUnicode_AsString
Karsten Hopp 2c69c3
! #  define _PyUnicode_AsString py3_PyUnicode_AsUTF8String
Karsten Hopp 2c69c3
! # else
Karsten Hopp 2c69c3
! #  define _PyUnicode_AsString py3__PyUnicode_AsString
Karsten Hopp 2c69c3
! # endif
Karsten Hopp 2c69c3
  # undef PyUnicode_AsEncodedString
Karsten Hopp 2c69c3
  # define PyUnicode_AsEncodedString py3_PyUnicode_AsEncodedString
Karsten Hopp 2c69c3
  # undef PyBytes_AsString
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 281,287 ****
Karsten Hopp 2c69c3
--- 286,296 ----
Karsten Hopp 2c69c3
  static PyObject* py3__Py_TrueStruct;
Karsten Hopp 2c69c3
  static int (*py3_PyModule_AddObject)(PyObject *m, const char *name, PyObject *o);
Karsten Hopp 2c69c3
  static int (*py3_PyImport_AppendInittab)(const char *name, PyObject* (*initfunc)(void));
Karsten Hopp 2c69c3
+ #if PY_VERSION_HEX >= 0x030300f0
Karsten Hopp 2c69c3
+ static char* (*py3_PyUnicode_AsUTF8String)(PyObject *unicode);
Karsten Hopp 2c69c3
+ #else
Karsten Hopp 2c69c3
  static char* (*py3__PyUnicode_AsString)(PyObject *unicode);
Karsten Hopp 2c69c3
+ #endif
Karsten Hopp 2c69c3
  static PyObject* (*py3_PyUnicode_AsEncodedString)(PyObject *unicode, const char* encoding, const char* errors);
Karsten Hopp 2c69c3
  static char* (*py3_PyBytes_AsString)(PyObject *bytes);
Karsten Hopp 2c69c3
  static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, int *length);
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 397,403 ****
Karsten Hopp 2c69c3
--- 406,416 ----
Karsten Hopp 2c69c3
      {"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init},
Karsten Hopp 2c69c3
      {"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject},
Karsten Hopp 2c69c3
      {"PyImport_AppendInittab", (PYTHON_PROC*)&py3_PyImport_AppendInittab},
Karsten Hopp 2c69c3
+ #if PY_VERSION_HEX >= 0x030300f0
Karsten Hopp 2c69c3
+     {"PyUnicode_AsUTF8String", (PYTHON_PROC*)&py3_PyUnicode_AsUTF8String},
Karsten Hopp 2c69c3
+ #else
Karsten Hopp 2c69c3
      {"_PyUnicode_AsString", (PYTHON_PROC*)&py3__PyUnicode_AsString},
Karsten Hopp 2c69c3
+ #endif
Karsten Hopp 2c69c3
      {"PyBytes_AsString", (PYTHON_PROC*)&py3_PyBytes_AsString},
Karsten Hopp 2c69c3
      {"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize},
Karsten Hopp 2c69c3
      {"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 490,495 ****
Karsten Hopp 2c69c3
--- 503,514 ----
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
      /* Load unicode functions separately as only the ucs2 or the ucs4 functions
Karsten Hopp 2c69c3
       * will be present in the library. */
Karsten Hopp 2c69c3
+ #if PY_VERSION_HEX >= 0x030300f0
Karsten Hopp 2c69c3
+     ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString");
Karsten Hopp 2c69c3
+     ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode");
Karsten Hopp 2c69c3
+     ucs_as_encoded_string = symbol_from_dll(hinstPy3,
Karsten Hopp 2c69c3
+ 	    "PyUnicode_AsEncodedString");
Karsten Hopp 2c69c3
+ #else
Karsten Hopp 2c69c3
      ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString");
Karsten Hopp 2c69c3
      ucs_decode = symbol_from_dll(hinstPy3,
Karsten Hopp 2c69c3
  	    "PyUnicodeUCS2_Decode");
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 504,509 ****
Karsten Hopp 2c69c3
--- 523,529 ----
Karsten Hopp 2c69c3
  	ucs_as_encoded_string = symbol_from_dll(hinstPy3,
Karsten Hopp 2c69c3
  		"PyUnicodeUCS4_AsEncodedString");
Karsten Hopp 2c69c3
      }
Karsten Hopp 2c69c3
+ #endif
Karsten Hopp 2c69c3
      if (ucs_from_string && ucs_decode && ucs_as_encoded_string)
Karsten Hopp 2c69c3
      {
Karsten Hopp 2c69c3
  	py3_PyUnicode_FromString = ucs_from_string;
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 600,607 ****
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
  #define GET_ATTR_STRING(name, nameobj) \
Karsten Hopp 2c69c3
      char	*name = ""; \
Karsten Hopp 2c69c3
!     if(PyUnicode_Check(nameobj)) \
Karsten Hopp 2c69c3
!         name = _PyUnicode_AsString(nameobj)
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
  #define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
--- 620,627 ----
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
  #define GET_ATTR_STRING(name, nameobj) \
Karsten Hopp 2c69c3
      char	*name = ""; \
Karsten Hopp 2c69c3
!     if (PyUnicode_Check(nameobj)) \
Karsten Hopp 2c69c3
! 	name = _PyUnicode_AsString(nameobj)
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
  #define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 704,709 ****
Karsten Hopp 2c69c3
--- 724,731 ----
Karsten Hopp 2c69c3
  	Py_SetPythonHome(PYTHON3_HOME);
Karsten Hopp 2c69c3
  #endif
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
+ 	PyImport_AppendInittab("vim", Py3Init_vim);
Karsten Hopp 2c69c3
+ 
Karsten Hopp 2c69c3
  #if !defined(MACOS) || defined(MACOS_X_UNIX)
Karsten Hopp 2c69c3
  	Py_Initialize();
Karsten Hopp 2c69c3
  #else
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 719,726 ****
Karsten Hopp 2c69c3
  	if (PythonIO_Init())
Karsten Hopp 2c69c3
  	    goto fail;
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
- 	PyImport_AppendInittab("vim", Py3Init_vim);
Karsten Hopp 2c69c3
- 
Karsten Hopp 2c69c3
  	globals = PyModule_GetDict(PyImport_AddModule("__main__"));
Karsten Hopp 2c69c3
  
Karsten Hopp 2c69c3
  	/* Remove the element from sys.path that was added because of our
Karsten Hopp 2c69c3
--- 741,746 ----
Karsten Hopp 2c69c3
*** ../vim-7.3.687/src/version.c	2012-10-11 04:44:26.000000000 +0200
Karsten Hopp 2c69c3
--- src/version.c	2012-10-14 03:00:57.000000000 +0200
Karsten Hopp 2c69c3
***************
Karsten Hopp 2c69c3
*** 721,722 ****
Karsten Hopp 2c69c3
--- 721,724 ----
Karsten Hopp 2c69c3
  {   /* Add new patch number below this line */
Karsten Hopp 2c69c3
+ /**/
Karsten Hopp 2c69c3
+     688,
Karsten Hopp 2c69c3
  /**/
Karsten Hopp 2c69c3
Karsten Hopp 2c69c3
-- 
Karsten Hopp 2c69c3
The problem with political jokes is that they get elected.
Karsten Hopp 2c69c3
Karsten Hopp 2c69c3
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 2c69c3
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 2c69c3
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 2c69c3
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///