Repository: pylint-dev/astroid

Issue:
IndexError when calling extract_node
The execution of the below code results in an exception with the following message: `IndexError: list index out of range`. This exception occurs in `_extract_expressions` at line 321 in `builder.py`. 
```python
from astroid.brain.brain_boto3 import extract_node
extract_node("__()")
```

### Version:
`v4.0.0.dev1` -- also occurs in `v3.3.10`

### Traceback Report
```
Traceback (most recent call last):
  File "rep.py", line 2, in <module>
    extract_node("__()")
  File "lib/python3.9/site-packages/astroid/builder.py", line 452, in extract_node
    extracted.extend(_extract_expressions(tree))
  File "ib/python3.9/site-packages/astroid/builder.py", line 340, in _extract_expressions
    yield from _extract_expressions(child)
  File "lib/python3.9/site-packages/astroid/builder.py", line 340, in _extract_expressions
    yield from _extract_expressions(child)
  File "lib/python3.9/site-packages/astroid/builder.py", line 321, in _extract_expressions
    real_expr = node.args[0]
IndexError: list index out of range
```

Discussion:
@Pierre-Sassoulas: Nice catch, it seems you hit some internal implementation quirks. Are you using fuzzing 😄 ?@gabe-sherman: I sure am, thanks for the quick response!@Pierre-Sassoulas: The fix will be released in 3.3.11, probably at the same time than the fix for #2733 

Solution patch:
diff --git a/astroid/builder.py b/astroid/builder.py
index 6fa7be68..6205f83d 100644
--- a/astroid/builder.py
+++ b/astroid/builder.py
@@ -317,6 +317,7 @@ def _extract_expressions(node: nodes.NodeNG) -> Iterator[nodes.NodeNG]:
         isinstance(node, nodes.Call)
         and isinstance(node.func, nodes.Name)
         and node.func.name == _TRANSIENT_FUNCTION
+        and node.args
     ):
         real_expr = node.args[0]
         assert node.parent


Test patch:
diff --git a/tests/test_regrtest.py b/tests/test_regrtest.py
index 76a7ceae..5321c7e0 100644
--- a/tests/test_regrtest.py
+++ b/tests/test_regrtest.py
@@ -498,3 +498,9 @@ def test_regression_missing_callcontext() -> None:
         )
     )
     assert node.inferred()[0].value == "mystr"
+
+
+def test_regression_no_crash_during_build() -> None:
+    node: nodes.Attribute = extract_node("__()")
+    assert node.args == []
+    assert node.as_string() == "__()"