py26 functionality in restricted.py

47 views
Skip to first unread message

Leonel Câmara

unread,
May 18, 2016, 2:42:45 PM5/18/16
to web2py-developers
Hey I'm cleaning code that needs to version check if your python version is < than 2.7 from stuff in gluon that is not contrib (no point cleaning contrib as it will be updated with newer versions of the modules there that may or may not support earlier python versions)

In the process of doing that, I've come across these lines in restricted.py that as far as I can tell from our git have been there from the start:

    if isinstance(evalue, BaseException):
        for name in dir(evalue):
            # prevent py26 DeprecatedWarning:
            if name != 'message' or sys.version_info < (2.6):
                value = pydoc.text.repr(getattr(evalue, name))
                s['exception'][name] = value

I was just going to erase the "or sys.version_info < (2.6)" but I'm thinking, can't I just completely remove all these lines, what's the problem with the name being different from message?

Leonel Câmara

unread,
May 19, 2016, 2:10:00 PM5/19/16
to web2py-developers
Ok, since no one can explain to me why this "if name != 'message' or sys.version_info < (2.6)" is still necessary I just removed the it, I also found two memory leaks in restricted.py caused by circular references due to not deleting traceback holding local variables.

Richard Vézina

unread,
May 19, 2016, 2:53:21 PM5/19/16
to web2py-d...@googlegroups.com
I guess we need Massimo's advice here...

Does we drop python 2.6? if so I guess it not useful...

Richard

On Thu, May 19, 2016 at 2:09 PM, Leonel Câmara <leonel...@gmail.com> wrote:
Ok, since no one can explain to me why this "if name != 'message' or sys.version_info < (2.6)" is still necessary I just removed the it, I also found two memory leaks in restricted.py caused by circular references due to not deleting traceback holding local variables.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Leonel Câmara

unread,
May 19, 2016, 3:52:11 PM5/19/16
to web2py-developers
Yeah we're dropping 2.6 I already removed our implementations of simplejson and ordereddict for instance. The modules still there are dummy modules, just so people that are using them don't get their applications broken. Of course, ideally, we could also remove these dummy modules, but they will have to stay until web2py has some kind of deprecation policy that allows it.

Massimo DiPierro

unread,
May 19, 2016, 4:55:25 PM5/19/16
to web2py-d...@googlegroups.com
yes. we are dropping 2.6. web2py is about good practice and there is no reason any more to use 2.6.

On Thu, May 19, 2016 at 2:52 PM, Leonel Câmara <leonel...@gmail.com> wrote:
Yeah we're dropping 2.6 I already removed our implementations of simplejson and ordereddict for instance. The modules still there are dummy modules, just so people that are using them don't get their applications broken. Of course, ideally, we could also remove these dummy modules, but they will have to stay until web2py has some kind of deprecation policy that allows it.

--

Richard Vézina

unread,
May 19, 2016, 5:06:12 PM5/19/16
to web2py-d...@googlegroups.com
Good news!!

:)
Reply all
Reply to author
Forward
0 new messages