@@ -2215,4 +2215,136 @@ var compileTestData = []struct {
22152215 Firstlineno : 1 ,
22162216 Lnotab : "" ,
22172217 }, nil , "" },
2218+ {"def fn(a):\n global b\n b = a" , "exec" , & py.Code {
2219+ Argcount : 0 ,
2220+ Kwonlyargcount : 0 ,
2221+ Nlocals : 0 ,
2222+ Stacksize : 2 ,
2223+ Flags : 64 ,
2224+ Code : "\x64 \x00 \x00 \x64 \x01 \x00 \x84 \x00 \x00 \x5a \x00 \x00 \x64 \x02 \x00 \x53 " ,
2225+ Consts : []py.Object {& py.Code {
2226+ Argcount : 1 ,
2227+ Kwonlyargcount : 0 ,
2228+ Nlocals : 1 ,
2229+ Stacksize : 1 ,
2230+ Flags : 67 ,
2231+ Code : "\x7c \x00 \x00 \x61 \x00 \x00 \x64 \x00 \x00 \x53 " ,
2232+ Consts : []py.Object {py .None },
2233+ Names : []string {"b" },
2234+ Varnames : []string {"a" },
2235+ Freevars : []string {},
2236+ Cellvars : []string {},
2237+ Filename : "<string>" ,
2238+ Name : "fn" ,
2239+ Firstlineno : 1 ,
2240+ Lnotab : "\x00 \x02 " ,
2241+ }, py .String ("fn" ), py .None },
2242+ Names : []string {"fn" },
2243+ Varnames : []string {},
2244+ Freevars : []string {},
2245+ Cellvars : []string {},
2246+ Filename : "<string>" ,
2247+ Name : "<module>" ,
2248+ Firstlineno : 1 ,
2249+ Lnotab : "" ,
2250+ }, nil , "" },
2251+ {"def fn(): return" , "exec" , & py.Code {
2252+ Argcount : 0 ,
2253+ Kwonlyargcount : 0 ,
2254+ Nlocals : 0 ,
2255+ Stacksize : 2 ,
2256+ Flags : 64 ,
2257+ Code : "\x64 \x00 \x00 \x64 \x01 \x00 \x84 \x00 \x00 \x5a \x00 \x00 \x64 \x02 \x00 \x53 " ,
2258+ Consts : []py.Object {& py.Code {
2259+ Argcount : 0 ,
2260+ Kwonlyargcount : 0 ,
2261+ Nlocals : 0 ,
2262+ Stacksize : 1 ,
2263+ Flags : 67 ,
2264+ Code : "\x64 \x00 \x00 \x53 " ,
2265+ Consts : []py.Object {py .None },
2266+ Names : []string {},
2267+ Varnames : []string {},
2268+ Freevars : []string {},
2269+ Cellvars : []string {},
2270+ Filename : "<string>" ,
2271+ Name : "fn" ,
2272+ Firstlineno : 1 ,
2273+ Lnotab : "" ,
2274+ }, py .String ("fn" ), py .None },
2275+ Names : []string {"fn" },
2276+ Varnames : []string {},
2277+ Freevars : []string {},
2278+ Cellvars : []string {},
2279+ Filename : "<string>" ,
2280+ Name : "<module>" ,
2281+ Firstlineno : 1 ,
2282+ Lnotab : "" ,
2283+ }, nil , "" },
2284+ {"def fn(): return a" , "exec" , & py.Code {
2285+ Argcount : 0 ,
2286+ Kwonlyargcount : 0 ,
2287+ Nlocals : 0 ,
2288+ Stacksize : 2 ,
2289+ Flags : 64 ,
2290+ Code : "\x64 \x00 \x00 \x64 \x01 \x00 \x84 \x00 \x00 \x5a \x00 \x00 \x64 \x02 \x00 \x53 " ,
2291+ Consts : []py.Object {& py.Code {
2292+ Argcount : 0 ,
2293+ Kwonlyargcount : 0 ,
2294+ Nlocals : 0 ,
2295+ Stacksize : 1 ,
2296+ Flags : 67 ,
2297+ Code : "\x74 \x00 \x00 \x53 " ,
2298+ Consts : []py.Object {py .None },
2299+ Names : []string {"a" },
2300+ Varnames : []string {},
2301+ Freevars : []string {},
2302+ Cellvars : []string {},
2303+ Filename : "<string>" ,
2304+ Name : "fn" ,
2305+ Firstlineno : 1 ,
2306+ Lnotab : "" ,
2307+ }, py .String ("fn" ), py .None },
2308+ Names : []string {"fn" },
2309+ Varnames : []string {},
2310+ Freevars : []string {},
2311+ Cellvars : []string {},
2312+ Filename : "<string>" ,
2313+ Name : "<module>" ,
2314+ Firstlineno : 1 ,
2315+ Lnotab : "" ,
2316+ }, nil , "" },
2317+ {"def fn():\n \" docstring\" \n return True" , "exec" , & py.Code {
2318+ Argcount : 0 ,
2319+ Kwonlyargcount : 0 ,
2320+ Nlocals : 0 ,
2321+ Stacksize : 2 ,
2322+ Flags : 64 ,
2323+ Code : "\x64 \x00 \x00 \x64 \x01 \x00 \x84 \x00 \x00 \x5a \x00 \x00 \x64 \x02 \x00 \x53 " ,
2324+ Consts : []py.Object {& py.Code {
2325+ Argcount : 0 ,
2326+ Kwonlyargcount : 0 ,
2327+ Nlocals : 0 ,
2328+ Stacksize : 1 ,
2329+ Flags : 67 ,
2330+ Code : "\x64 \x01 \x00 \x53 " ,
2331+ Consts : []py.Object {py .String ("docstring" ), py .True },
2332+ Names : []string {},
2333+ Varnames : []string {},
2334+ Freevars : []string {},
2335+ Cellvars : []string {},
2336+ Filename : "<string>" ,
2337+ Name : "fn" ,
2338+ Firstlineno : 1 ,
2339+ Lnotab : "\x00 \x02 " ,
2340+ }, py .String ("fn" ), py .None },
2341+ Names : []string {"fn" },
2342+ Varnames : []string {},
2343+ Freevars : []string {},
2344+ Cellvars : []string {},
2345+ Filename : "<string>" ,
2346+ Name : "<module>" ,
2347+ Firstlineno : 1 ,
2348+ Lnotab : "" ,
2349+ }, nil , "" },
22182350}
0 commit comments