comparison src/if_py_both.h @ 30310:029c59bf78f1 v9.0.0491

patch 9.0.0491: no good reason to build without the float feature Commit: https://github.com/vim/vim/commit/73e28dcc6125f616cf1f2d56443d22428a79e434 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 17 21:08:33 2022 +0100 patch 9.0.0491: no good reason to build without the float feature Problem: No good reason to build without the float feature. Solution: Remove configure check for float and "#ifdef FEAT_FLOAT".
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Sep 2022 22:15:05 +0200
parents 89e1d67814a9
children 684e6dfa2fba
comparison
equal deleted inserted replaced
30309:4ba3d27b5357 30310:029c59bf78f1
759 759
760 // For backwards compatibility numbers are stored as strings. 760 // For backwards compatibility numbers are stored as strings.
761 sprintf(buf, "%ld", (long)our_tv->vval.v_number); 761 sprintf(buf, "%ld", (long)our_tv->vval.v_number);
762 ret = PyString_FromString((char *)buf); 762 ret = PyString_FromString((char *)buf);
763 } 763 }
764 #ifdef FEAT_FLOAT
765 else if (our_tv->v_type == VAR_FLOAT) 764 else if (our_tv->v_type == VAR_FLOAT)
766 { 765 {
767 char buf[NUMBUFLEN]; 766 char buf[NUMBUFLEN];
768 767
769 sprintf(buf, "%f", our_tv->vval.v_float); 768 sprintf(buf, "%f", our_tv->vval.v_float);
770 ret = PyString_FromString((char *)buf); 769 ret = PyString_FromString((char *)buf);
771 } 770 }
772 #endif
773 else if (our_tv->v_type == VAR_LIST) 771 else if (our_tv->v_type == VAR_LIST)
774 { 772 {
775 list_T *list = our_tv->vval.v_list; 773 list_T *list = our_tv->vval.v_list;
776 listitem_T *curr; 774 listitem_T *curr;
777 775
6327 if (PyErr_Occurred()) 6325 if (PyErr_Occurred())
6328 return -1; 6326 return -1;
6329 } 6327 }
6330 else if (PyDict_Check(obj)) 6328 else if (PyDict_Check(obj))
6331 return convert_dl(obj, tv, pydict_to_tv, lookup_dict); 6329 return convert_dl(obj, tv, pydict_to_tv, lookup_dict);
6332 #ifdef FEAT_FLOAT
6333 else if (PyFloat_Check(obj)) 6330 else if (PyFloat_Check(obj))
6334 { 6331 {
6335 tv->v_type = VAR_FLOAT; 6332 tv->v_type = VAR_FLOAT;
6336 tv->vval.v_float = (float_T) PyFloat_AsDouble(obj); 6333 tv->vval.v_float = (float_T) PyFloat_AsDouble(obj);
6337 } 6334 }
6338 #endif
6339 else if (PyObject_HasAttrString(obj, "keys")) 6335 else if (PyObject_HasAttrString(obj, "keys"))
6340 return convert_dl(obj, tv, pymap_to_tv, lookup_dict); 6336 return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
6341 // PyObject_GetIter can create built-in iterator for any sequence object 6337 // PyObject_GetIter can create built-in iterator for any sequence object
6342 else if (PyIter_Check(obj) || PySequence_Check(obj)) 6338 else if (PyIter_Check(obj) || PySequence_Check(obj))
6343 return convert_dl(obj, tv, pyseq_to_tv, lookup_dict); 6339 return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
6386 return PyBytes_FromString(tv->vval.v_string == NULL 6382 return PyBytes_FromString(tv->vval.v_string == NULL
6387 ? "" : (char *)tv->vval.v_string); 6383 ? "" : (char *)tv->vval.v_string);
6388 case VAR_NUMBER: 6384 case VAR_NUMBER:
6389 return PyLong_FromLong((long) tv->vval.v_number); 6385 return PyLong_FromLong((long) tv->vval.v_number);
6390 case VAR_FLOAT: 6386 case VAR_FLOAT:
6391 #ifdef FEAT_FLOAT
6392 return PyFloat_FromDouble((double) tv->vval.v_float); 6387 return PyFloat_FromDouble((double) tv->vval.v_float);
6393 #endif
6394 case VAR_LIST: 6388 case VAR_LIST:
6395 return NEW_LIST(tv->vval.v_list); 6389 return NEW_LIST(tv->vval.v_list);
6396 case VAR_DICT: 6390 case VAR_DICT:
6397 return NEW_DICTIONARY(tv->vval.v_dict); 6391 return NEW_DICTIONARY(tv->vval.v_dict);
6398 case VAR_FUNC: 6392 case VAR_FUNC: