Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Stop generating string rep of dict when converting to list. Tolerate NULL interps more completely. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
849162b0bf2e6f24809a32b777ff2d4a |
User & Date: | dgp 2011-05-05 18:28:14 |
Context
2011-05-06
| ||
07:55 | comment fix check-in: fa4eb25ecf user: jan.nijtmans tags: trunk | |
2011-05-05
| ||
18:28 | Stop generating string rep of dict when converting to list. Tolerate NULL interps more completely. check-in: 849162b0bf user: dgp tags: trunk | |
16:53 | Tolerate NULL interps more completely. check-in: e7adc1255d user: dgp tags: core-8-5-branch | |
15:32 | Fix typo spotted by Emiliano Gavilan. check-in: 0ef5e8c424 user: dkf tags: trunk | |
Changes
Changes to ChangeLog.
1 2 3 4 5 6 7 | 2011-05-03 Don Porter <[email protected]> * generic/tclUtil.c: Tighten Tcl_SplitList(). * generic/tclListObj.c: Tighten SetListFromAny(). * generic/tclDictObj.c: Tighten SetDictFromAny(). * tests/join.test: * tests/mathop.test: | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 | 2011-05-05 Don Porter <[email protected]> * generic/tclListObj.c: Stop generating string rep of dict when converting to list. Tolerate NULL interps more completely. 2011-05-03 Don Porter <[email protected]> * generic/tclUtil.c: Tighten Tcl_SplitList(). * generic/tclListObj.c: Tighten SetListFromAny(). * generic/tclDictObj.c: Tighten SetDictFromAny(). * tests/join.test: * tests/mathop.test: |
︙ | ︙ |
Changes to generic/tclListObj.c.
︙ | ︙ | |||
584 585 586 587 588 589 590 | if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendElement"); } if (listPtr->typePtr != &tclListType) { int result, length; | > > > | > | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendElement"); } if (listPtr->typePtr != &tclListType) { int result, length; if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { (void) TclGetStringFromObj(listPtr, &length); } if (!length) { Tcl_SetListObj(listPtr, 1, &objPtr); return TCL_OK; } result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { |
︙ | ︙ | |||
694 695 696 697 698 699 700 | Tcl_Obj **objPtrPtr) /* The resulting Tcl_Obj* is stored here. */ { register List *listRepPtr; if (listPtr->typePtr != &tclListType) { int result, length; | > > > | > | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | Tcl_Obj **objPtrPtr) /* The resulting Tcl_Obj* is stored here. */ { register List *listRepPtr; if (listPtr->typePtr != &tclListType) { int result, length; if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { (void) TclGetStringFromObj(listPtr, &length); } if (!length) { *objPtrPtr = NULL; return TCL_OK; } result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { |
︙ | ︙ | |||
749 750 751 752 753 754 755 | register int *intPtr) /* The resulting int is stored here. */ { register List *listRepPtr; if (listPtr->typePtr != &tclListType) { int result, length; | > > > > > > > > > > > > | > | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | register int *intPtr) /* The resulting int is stored here. */ { register List *listRepPtr; if (listPtr->typePtr != &tclListType) { int result, length; if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); /* * It's tempting to just report 2*length as the list length * of this dict, but arguably that's false since the max sizes * for dicts and lists are not the same, so some dicts don't * actually convert to lists, and it's good to get that error * back from the SetListFromAny() call below instead of a false * indication we can treat the value as a list. ([llength $val] * often used as a "listiness" test) */ } else { (void) TclGetStringFromObj(listPtr, &length); } if (!length) { *intPtr = 0; return TCL_OK; } result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { |
︙ | ︙ | |||
824 825 826 827 828 829 830 | if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "Tcl_ListObjReplace"); } if (listPtr->typePtr != &tclListType) { int length; | > > > | > | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "Tcl_ListObjReplace"); } if (listPtr->typePtr != &tclListType) { int length; if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { (void) TclGetStringFromObj(listPtr, &length); } if (!length) { if (objc) { Tcl_SetListObj(listPtr, objc, NULL); } else { return TCL_OK; } } else { |
︙ | ︙ | |||
1369 1370 1371 1372 1373 1374 1375 | indexArray++; break; } indexArray++; if (index < 0 || index > elemCount) { /* ...the index points outside the sublist. */ | > | | > | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 | indexArray++; break; } indexArray++; if (index < 0 || index > elemCount) { /* ...the index points outside the sublist. */ if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("list index out of range", -1)); } Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", "BADINDEX", NULL); break; } /* * No error conditions. As long as we're not yet on the last index, |
︙ | ︙ | |||
1541 1542 1543 1544 1545 1546 1547 | if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "TclListObjSetElement"); } if (listPtr->typePtr != &tclListType) { int length, result; | > > > | > > | | > | 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 | if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "TclListObjSetElement"); } if (listPtr->typePtr != &tclListType) { int length, result; if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { (void) TclGetStringFromObj(listPtr, &length); } if (!length) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("list index out of range", -1)); } Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", "BADINDEX", NULL); return TCL_ERROR; } result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; |
︙ | ︙ |