Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13446 closed (invalid)

isintance bug with Python 2.4.4 | django.core.urlresolvers.RegexURLResolver affected

Reported by: pavl Owned by: nobody
Component: Core (Other) Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Inside "django.core.urlresolvers.RegexURLResolver" at line:

    def _populate(self):
...
            if isinstance(pattern, RegexURLResolver)

The method isinstance, under Python 2.4.4, does not work properly.

I got the exception: 'RegexURLResolver' object has no attribute 'name' at line:

            else:
...
                lookups.appendlist(pattern.name, (bits, p_pattern))

where a pattern was:

pattern   <RegexURLResolver oteracapital.apps.localeflatpages.urls (None:None) >

Which means that if isinstance(pattern, RegexURLResolver) returned False in that case.

In my opinion you should force the installation of latest Python 2.x to avoid such problem.

Change History (4)

comment:1 Changed 6 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Uhh, that's a pretty lofty accusation that isinstance is broken in python 2.4.4, do you have a citation, or *how* exactly it is broken?

comment:2 Changed 6 years ago by pavl

Just to be clear here, I wasn't saying that the bug came from Python itself but from Django. I am sorry if there was a misunderstood.

On DEV, with Python 2.6.5, I got no error what so ever.
On production server, with Python 2.4.4, I get the error.

The test below fails to see that 'pattern' is a RegexURLResolver object:

if isinstance(pattern, RegexURLResolver)

where pattern is:

pattern   <RegexURLResolver oteracapital.apps.localeflatpages.urls (None:None) >

I have this exception when I use the resolver function inside a view with a pattern like: 'namespace:name'.
I will upload the code tomorrow for more details.

comment:3 Changed 6 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

Extraordinary claims require extraordinary proof. Given that this ticket provides no specific evidence of the claim, I'm closing it invalid.

Please reopen if you can provide a specific test case or example that fails under Python 2.4.4, but not under other versions of Python.

comment:4 Changed 6 years ago by pavl

I appologize about this ticket.

I investiguated more and found out that the bug came from the application's installation.
Nothing about Django or Python fault.


Django was visible on PYTHONPATH via a system link inside the application directory. That means all django module were mapped to: <application directory>.django...


This is bad, and believe me... I feel bad. :S - yes you can laugh.

Note: See TracTickets for help on using tickets.
Back to Top