Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag to tm_tags_find() to indicate the tags array may not be sorted
tm_tags_find() relies on a sorted tags array to be passed in but in tm_source_file_set_tag_arglist() we don't have a sorted array yet and sorting it on demand seems more heavy than the alternative: make tm_tags_find() search the array linear if the new flag is set. This fixes a bug in the Python parser when assigning the argument list of __init__() methods to their class' argument list which annoyed me for years already. Also add a test case for this.
- Loading branch information
Showing
7 changed files
with
89 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Test arglist parsing of a class' __init__ method: | ||
the __init__() method's argument list should be assigned to the class' argument list. | ||
This is somewhat special to Python and the Python parses uses tm_source_file_set_tag_arglist() | ||
to do this and tm_source_file_set_tag_arglist() uses tm_tags_find() which by default relies on | ||
a sorted tags array. However, when the parses uses tm_source_file_set_tag_arglist() the tags | ||
array is *not yet* sorted and so it might be the tag for the class SomeClass can't be found, | ||
hence this test. | ||
""" | ||
|
||
from bsddb import btopen | ||
import sys | ||
from django.contrib.auth.decorators import login_required, permission_required | ||
from django.http import HttpResponse, HttpResponseBadRequest | ||
from django.shortcuts import render_to_response | ||
from django.template.context import RequestContext | ||
from django.utils import simplejson | ||
from django.views.decorators.csrf import csrf_exempt | ||
from django.views.decorators.csrf import csrf_exempt2 | ||
from django.views.decorators.http import require_POST | ||
from vnstat.api.error import InterfaceDataValidationError | ||
|
||
|
||
class SomeClass(object): | ||
|
||
def __init__(self, filename, pathsep='', treegap=64): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# format=tagmanager | ||
HttpResponse�256�0 | ||
HttpResponseBadRequest�256�0 | ||
InterfaceDataValidationError�256�0 | ||
RequestContext�256�0 | ||
SomeClass�1�(self, filename, pathsep='', treegap=64)�0 | ||
__init__�128�(self, filename, pathsep='', treegap=64)�SomeClass�0 | ||
btopen�256�0 | ||
csrf_exempt�256�0 | ||
csrf_exempt2�256�0 | ||
login_required�256�0 | ||
permission_required�256�0 | ||
render_to_response�256�0 | ||
require_POST�256�0 | ||
simplejson�256�0 | ||
sys�256�0 |