⚒️ Generated with [Fabro](https://fabro.sh)
This commit is contained in:
Fabro 2026-03-16 01:32:33 -04:00
parent 6cb40f39a4
commit b34a7fc2f6
3 changed files with 49 additions and 0 deletions

31
graph.fabro Normal file
View file

@ -0,0 +1,31 @@
digraph SWEBench {
graph [goal="Upgrading 2.2>3.0 causes named tuples used as arguments to __range to error.
Description
I noticed this while upgrading a project from 2.2 to 3.0.
This project passes named 2-tuples as arguments to range queryset filters. This works fine on 2.2. On 3.0 it causes the following error: TypeError: __new__() missing 1 required positional argument: 'far'.
This happens because django.db.models.sql.query.Query.resolve_lookup_value goes into the tuple elements to resolve lookups and then attempts to reconstitute the tuple with the resolved elements.
When it attempts to construct the new tuple it preserves the type (the named tuple) but it passes a iterator to it's constructor.
NamedTuples don't have the code path for copying an iterator, and so it errors on insufficient arguments.
The fix is to * expand the contents of the iterator into the constructor.
"]
rankdir=LR
start [shape=Mdiamond]
exit [shape=Msquare]
setup [label="Setup", shape=parallelogram, script="git clone https://github.com/django/django.git . && git checkout 755dbf39fcdc491fe9b588358303e259c7750be4 && python -m pip install -e ."]
solve [label="Solve", prompt="Fix this GitHub issue in the repository. Make the minimal code change needed.\n\nUpgrading 2.2>3.0 causes named tuples used as arguments to __range to error.
Description
I noticed this while upgrading a project from 2.2 to 3.0.
This project passes named 2-tuples as arguments to range queryset filters. This works fine on 2.2. On 3.0 it causes the following error: TypeError: __new__() missing 1 required positional argument: 'far'.
This happens because django.db.models.sql.query.Query.resolve_lookup_value goes into the tuple elements to resolve lookups and then attempts to reconstitute the tuple with the resolved elements.
When it attempts to construct the new tuple it preserves the type (the named tuple) but it passes a iterator to it's constructor.
NamedTuples don't have the code path for copying an iterator, and so it errors on insufficient arguments.
The fix is to * expand the contents of the iterator into the constructor.
"]
extract_patch [label="Extract Patch", shape=parallelogram, script="git diff"]
start -> setup -> solve -> extract_patch -> exit
}

13
manifest.json Normal file
View file

@ -0,0 +1,13 @@
{
"run_id": "01KKTJ36XVQF9JY9Q8SBGN8BKP",
"workflow_name": "SWEBench",
"goal": "Upgrading 2.2>3.0 causes named tuples used as arguments to __range to error.\nDescription\n\t\nI noticed this while upgrading a project from 2.2 to 3.0.\nThis project passes named 2-tuples as arguments to range queryset filters. This works fine on 2.2. On 3.0 it causes the following error: TypeError: __new__() missing 1 required positional argument: 'far'.\nThis happens because django.db.models.sql.query.Query.resolve_lookup_value goes into the tuple elements to resolve lookups and then attempts to reconstitute the tuple with the resolved elements.\nWhen it attempts to construct the new tuple it preserves the type (the named tuple) but it passes a iterator to it's constructor.\nNamedTuples don't have the code path for copying an iterator, and so it errors on insufficient arguments.\nThe fix is to * expand the contents of the iterator into the constructor.\n",
"start_time": "2026-03-16T05:32:33.614389Z",
"node_count": 5,
"edge_count": 4,
"run_branch": "fabro/run/01KKTJ36XVQF9JY9Q8SBGN8BKP",
"base_sha": "470fcfe1200b2102c0cdf91c73b0ed8d925f258a",
"base_branch": "main",
"workflow_slug": "django__django-13590",
"host_repo_path": "/Users/bhelmkamp/p/fabro-sh/fabro/evals/swe-bench/results/haiku-baseline/runs/django__django-13590"
}

5
sandbox.json Normal file
View file

@ -0,0 +1,5 @@
{
"provider": "daytona",
"working_directory": "/home/daytona/workspace",
"identifier": "fabro-01KKTJ36XVQF9JY9Q8SBGN8BKP"
}