comparison src/if_py_both.h @ 15454:1d2b5c016f17 v8.1.0735

patch 8.1.0735: cannot handle binary data commit https://github.com/vim/vim/commit/6e5ea8d2a995b32bbc5972edc4f827b959f2702f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 12 22:47:31 2019 +0100 patch 8.1.0735: cannot handle binary data Problem: Cannot handle binary data. Solution: Add the Blob type. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/3638)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Jan 2019 23:00:06 +0100
parents 9e6d1e80ca2b
children 55ccc2d353bd
comparison
equal deleted inserted replaced
15453:cdee6e827112 15454:1d2b5c016f17
865 Py_INCREF(Py_None); 865 Py_INCREF(Py_None);
866 ret = Py_None; 866 ret = Py_None;
867 } 867 }
868 return ret; 868 return ret;
869 } 869 }
870 else if (our_tv->v_type == VAR_BLOB)
871 ret = PyBytes_FromStringAndSize(
872 (char*) our_tv->vval.v_blob->bv_ga.ga_data,
873 (Py_ssize_t) our_tv->vval.v_blob->bv_ga.ga_len);
870 else 874 else
871 { 875 {
872 Py_INCREF(Py_None); 876 Py_INCREF(Py_None);
873 ret = Py_None; 877 ret = Py_None;
874 } 878 }
6392 return NEW_FUNCTION(tv->vval.v_partial == NULL 6396 return NEW_FUNCTION(tv->vval.v_partial == NULL
6393 ? (char_u *)"" : partial_name(tv->vval.v_partial), 6397 ? (char_u *)"" : partial_name(tv->vval.v_partial),
6394 tv->vval.v_partial->pt_argc, argv, 6398 tv->vval.v_partial->pt_argc, argv,
6395 tv->vval.v_partial->pt_dict, 6399 tv->vval.v_partial->pt_dict,
6396 tv->vval.v_partial->pt_auto); 6400 tv->vval.v_partial->pt_auto);
6401 case VAR_BLOB:
6402 return PyBytes_FromStringAndSize(
6403 (char*) tv->vval.v_blob->bv_ga.ga_data,
6404 (Py_ssize_t) tv->vval.v_blob->bv_ga.ga_len);
6397 case VAR_UNKNOWN: 6405 case VAR_UNKNOWN:
6398 case VAR_CHANNEL: 6406 case VAR_CHANNEL:
6399 case VAR_JOB: 6407 case VAR_JOB:
6400 Py_INCREF(Py_None); 6408 Py_INCREF(Py_None);
6401 return Py_None; 6409 return Py_None;