Friday, January 22, 2016

PyDev 4.5.3: Debugger fixes and improvements in PyUnit view

PyDev 4.5.3 is now available for download.

This release was done in such a short notice from the last release because a critical issue was fixed in the debugger (although it also added a few improvements to the PyUnit view, making the history dropdown show more information on the run and providing a way to export the results of a run to the clipboard, which are pretty nice).

As a note, LiClipse users (especially those using dark themes) should benefit a lot from the latest release, as it themes the trees and tables scrollbars (with the support from https://github.com/fappel/xiliary), so, it's a highly recommended download ;)

Anyways, I'll take the chance to talk about the bug which actually triggered this release (which was https://sw-brainwy.rhcloud.com/tracker/PyDev/650):

The PyDev debugger by default will monkey-patch all the calls which create a new process to automatically connect the debugger to the spawned processes if those are also Python processes -- and it also monkey-patches the os.fork to connect the forked process to the debugger.

Now, in os.fork it always connected the new process to the debugger, as it expected the new process to be a Python process, but there's a catch here: on Linux, subprocess.Popen will first fork the current process and then will do an os.execvp to replace the forked process with a new process, but in the latest version this was making the debugger crash (although it's still not 100% clear to me why that same process wasn't crashing before as the debugger already did this in previous versions -- anyways, os.execvp did some incantation under the hood which crashed when the debugger was setup when it was doing something as subprocess.Popen(['uname', '-m']), which first forked the process, connected it to the debugger and then replaced it with the uname executable).

So, the actual fix was detecting that it was forking for a subprocess.Popen and refrain from setting up the debugger if it was not executing a new Python program ;)

Enjoy!

4 comments:

  1. Anonymous11:03 AM

    PyDev install instructions without LiClipse here are broken. The below URL from the instructions doesn't work.

    Available update sites
    Main:
    http://pydev.org/updates

    Spent two hours trying to figure this out and finally the alternative link mentioned in 2011 StackOverflow post worked. Is your web site hacked and redirected?

    http://stackoverflow.com/questions/5714994/unable-to-load-the-repositorypydev-for-eclipse

    ReplyDelete
  2. Not sure why it didn't work for you (just tried it here and it worked -- also, haven't seen anything that may indicate that the site is compromised).

    Also, I've answered as a comment at that stackoverflow link, but, let me repeat it here:

    Please, DO NOT do that... the link from amazon is old, no longer kept and outdated!!! If you want, you can always visit http://www.pydev.org/updates and check what's the link it points to -- right now it's https://dl.bintray.com/fabioz/pydev/4.5.4, and it changes at each release.

    ReplyDelete
  3. Anonymous11:42 AM

    Sorry for putting the following comment , out of context.

    I would like to contribute to PyDev development though paypal, but i am not interested in creating an account with paypal.
    I request you to kindly allow people to contribute via paypal without haviong to create a paypal account.Other great projects like wikipedia, ubuntu etc already have this facility.

    thanks

    ReplyDelete
  4. Hello Anonymous ;)

    Well, right now, PayPal in Brazil (where I live) does not offer the possibility of receiving money from someone without a PayPal account (I already tried very hard having that)...

    What I integrated recently was tibit.com as an option too (you can see the link right below the link from PayPal in the PyDev homepage), or you can send bitcoins too...

    ReplyDelete