[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-06-05 Thread Eric Fahlgren
Eric Fahlgren added the comment: Thanks, Serhiy. I sort of figured that it would get fixed with the wordcode rework, and was going to verify that it was when 3.6 settled down. On Sun, Jun 5, 2016 at 8:30 AM, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > This bug was fixe

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This bug was fixed in issue26881 with similar patch. Sorry, I didn't know about this issue. Your patches look good. In any case thank you for your effort. -- nosy: +serhiy.storchaka resolution: -> out of date stage: -> resolved status: open -> close

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-03-11 Thread Barun Parruck
Barun Parruck added the comment: Hi! Okay, sorry for disappearing like that(this is becoming rather a habit isn't it!), but with Gsoc applications, I've been insanely busy trying to get patches and bugs accepted for my first Gsoc ever. I do apologize for leaving you hanging, it was not my int

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-03-02 Thread Eric Fahlgren
Eric Fahlgren added the comment: Barun, take a look at the latest version of the testfindlabels.py, see what you think. If it works for you, maybe move the test function into Lib/test/test_dis.py as part of the standard dis module tests. Still need to look at the code that's being tested and

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-03-02 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-03-02 Thread Barun Parruck
Barun Parruck added the comment: So...firstly hi, and sorry for disappearing like that! You want tests for the dis.findlabels library? What sort of tests are you looking for? Similiarly sized bytecode streams like the ones we worked with, or did you have something else in mind? B --

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-28 Thread Eric Fahlgren
Eric Fahlgren added the comment: Oops, wrong/bad patch, delete line 310 "arg = None" in _get_instruction_bytes... -- ___ Python tracker ___ __

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-28 Thread Eric Fahlgren
Eric Fahlgren added the comment: Two things: 1) Verified this has always been a problem and still is in the development branch, so I added 2.7 and 3.6 to the versions list. 2) Couldn't tolerate the duplicate code handling the extended args operator, so in the interests of DRY, I moved the cod

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-28 Thread Eric Fahlgren
Eric Fahlgren added the comment: I just remembered that code can have more than one (up to three?) EXTENDED_ARG operators before the real opcode, so I added that generalization to build code around the args list... -- Added file: http://bugs.python.org/file42046/testfindlabels.py

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-28 Thread Eric Fahlgren
Eric Fahlgren added the comment: Oh, don't worry about time between responses, we all have lives (well, some of us anyhow :) ). After looking at Lib/test/test_dis.py, I think it's just an oversight that there is no specific findlabels test (it's tested implicitly by ``dis.dis`` after all), an

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-28 Thread Barun Parruck
Barun Parruck added the comment: Hi, sorry, been pretty busy, and will be for a few days, so my replies may not be instant! Having looked through the dis test module, to be honest, I can't even find a call to dis.findlabels...odd. Maybe I've got it wrong, and I wouldn't mind somebody else tak

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-27 Thread Ned Deily
Changes by Ned Deily : -- nosy: +ncoghlan, yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-27 Thread Eric Fahlgren
Eric Fahlgren added the comment: Lookin' good so far. How about we try it on all the opcodes that have arguments? See attached example for which I can see two obvious improvements: 1) It could be improved by taking apart that "args" list and using it to synthesize "sample_code" rather than ha

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-27 Thread Barun Parruck
Barun Parruck added the comment: Sorry, the previous file had a bug. -- Added file: http://bugs.python.org/file42038/testfindlabels2.py ___ Python tracker ___ ___

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-27 Thread Barun Parruck
Barun Parruck added the comment: Four test cases have been included in the unittests, using the module unittest. One is the original one you gave me, the others are some that I played around with it, and thought would be useful to include. I would love some code reviews at this point! ---

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck
Barun Parruck added the comment: Hi, yes, that works much better, and I've definitely understood! Now, about the tests, how large would you like them to be? For instance : code = bytes ( chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(255) + chr(EXTENDED_ARG) + chr(1) + chr(1) +

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren
Eric Fahlgren added the comment: The findlabels function takes a bytecode array of type bytes, usually the actual code from a function. My original test case uses the full Python compiler from source code to a CodeType object to create the bytecodes (plus all that other stuff that makes up a fun

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck
Barun Parruck added the comment: Hi, I'm a little confused as to how to write a test using bytecode streams...probably due to my lack of clarity as to what exactly dis.disassemble does. Is there any way you could give me a bit more information? :) -- __

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck
Barun Parruck added the comment: The patch I forgot to attach. Ha ha. -- keywords: +patch Added file: http://bugs.python.org/file42035/preliminarypatch.diff ___ Python tracker __

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck
Barun Parruck added the comment: Allright, so I'm uploading a preliminary patch, please look through it to see if I understood what you meant me to do about dis.findlabels. The tests seem to mostly pass, except oddly enough, urlstdlib2, which is probably system-specific? I get the correct out

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren
Eric Fahlgren added the comment: Well, now that I'm thinking about it, you could synthesize a bytecode stream trivially and have a much better test. This is completely off the top of my head, so take it is guaranteed to (probably) not work as written, but it should get you started: from opco

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren
Eric Fahlgren added the comment: Our paths crossed, I don't know exactly how you'd add a test case for this, maybe construct the monster function in a string, eval the string, the use the synthesized function in dis.findlabels? -- ___ Python tracker

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren
Eric Fahlgren added the comment: My test case: def long(): z = a = b = c = d = e = f = g = h = 1 while x: x = x if x and x or not x else x above line repeated 2999 more times import dis print(dis.findlabels(long.__code__.co_code)[:10]) Buggy output: [35510, 35509, 62, 6

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck
Barun Parruck added the comment: Hi, to check if I've done things right, which functions did you try out dis.dis on? -- ___ Python tracker ___ __

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Barun Parruck
Barun Parruck added the comment: I'll take a look at it! :) Would you like unit tests as well? -- nosy: +Barun Parruck ___ Python tracker ___

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Joe Jevnik
Changes by Joe Jevnik : -- nosy: +ll ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-02-26 Thread Eric Fahlgren
New submission from Eric Fahlgren: When trying out dis.dis on some synthetically long functions, I noted that spurious branch targets were being generated in the output. First one is at address 8: 157 0 LOAD_CONST 1 (1) 3 DUP_TOP 4 STORE_FAS