Tcl Source Code

Check-in [0aa4803add]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Cherrypick: [fc1409fc91] Method cloning needs to be careful with body representations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 0aa4803add37797c7bb03c7ce09e72198cc79bc9587bc2fd0481fe78c2140911
User & Date: dkf 2017-10-24 14:11:16
Context
2017-10-27
12:50
Update tests that were still written on the outdated premise that Tcl's encoding subsystem had to in... check-in: 67d6de0b15 user: dgp tags: core-8-6-branch
12:04
merge mark check-in: 7446fb0672 user: dgp tags: trunk
2017-10-24
21:24
'array for' implementation (TIP #421) from Brad Lanam check-in: 4d4e808594 user: fvogel tags: tip-421, bll-array-for
14:11
Cherrypick: [fc1409fc91] Method cloning needs to be careful with body representations. check-in: 0aa4803add user: dkf tags: core-8-6-branch
13:30
Historical change affecting tests: Detroit did not observe Daylight Saving Time in 1967 check-in: 810600812c user: kbk tags: core-8-6-branch
11:25
[fc1409fc91] Method cloning needs to be careful with body representations. check-in: 0d7a96d2b5 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclOOMethod.c.

1310
1311
1312
1313
1314
1315
1316

1317
1318
1319
1320
1321
1322
1323
    /*
     * Must strip the internal representation in order to ensure that any
     * bound references to instance variables are removed. [Bug 3609693]
     */

    bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr);

    TclFreeIntRep(bodyObj);

    /*
     * Create the actual copy of the method record, manufacturing a new proc
     * record.
     */







>







1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
    /*
     * Must strip the internal representation in order to ensure that any
     * bound references to instance variables are removed. [Bug 3609693]
     */

    bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr);
    Tcl_GetString(bodyObj);
    TclFreeIntRep(bodyObj);

    /*
     * Create the actual copy of the method record, manufacturing a new proc
     * record.
     */

Changes to tests/oo.test.

2044
2045
2046
2047
2048
2049
2050











2051
2052
2053
2054
2055
2056
2057
    }
    lappend result [info commands ::dupens::t*]
    oo::copy obj obj2 ::dupens
    lappend result [info commands ::dupens::t*]
} -cleanup {
    Cls destroy
} -result {{} ::dupens::test-15.14}












test oo-16.1 {OO: object introspection} -body {
    info object
} -returnCodes 1 -result "wrong \# args: should be \"info object subcommand ?arg ...?\""
test oo-16.1.1 {OO: object introspection} -body {
    catch {info object} m o
    dict get $o -errorinfo






>
>
>
>
>
>
>
>
>
>
>







2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
    }
    lappend result [info commands ::dupens::t*]
    oo::copy obj obj2 ::dupens
    lappend result [info commands ::dupens::t*]
} -cleanup {
    Cls destroy
} -result {{} ::dupens::test-15.14}
test oo-15.15 {method cloning must ensure that there is a string representation of bodies} -setup {
    oo::class create cls
} -body {
    cls create foo
    oo::objdefine foo {
	method m1 {} [string map {a b} {return hello}] 
    }
    [oo::copy foo] m1
} -cleanup {
    cls destroy
} -result hello

test oo-16.1 {OO: object introspection} -body {
    info object
} -returnCodes 1 -result "wrong \# args: should be \"info object subcommand ?arg ...?\""
test oo-16.1.1 {OO: object introspection} -body {
    catch {info object} m o
    dict get $o -errorinfo