BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays
State: closed

- [X] closes #42430
- [X] tests added / passed
- [X] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [X] whatsnew entry

This PR contains a 1-line patch for issue #42430, plus a regression test to ensure the issue does not recur.

Before this change, `ExtensionBlock. getitem_block_index()` would request 2D slices of a block's underlying extension array, even though the `__getitem__()` method of `ExtensionArray` is (currently) only supposed to support 1D slicing. After the change, `getitem_block_index()` requests 1D slices. The change also fixes some linter/type checking errors.

Labels:
name: Bug
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
Looks like there was a single test failure on one of the CI builds. I'm not able to reproduce that failure on my machine. Can someone with the appropriate permissions rerun the `pytest (actions-39-numpydev.yaml, not slow and not network, xsel, deprecate, -W error)` build to see if the problem goes away by itself?

that should be fixed if you merge master
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
$ git checkout 1.3.x
$ git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
$ git cherry-pick -m1 26e7c0f840197259f3af06a397df99b9b9f638a3
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
$ git commit -am 'Backport PR #42787: BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays'
```

4. Push to a named branch :

```
git push YOURFORK 1.3.x:auto-backport-of-pr-42787-on-1.3.x
```

5. Create a PR against branch 1.3.x, I would have named this PR:

> "Backport PR #42787 on branch 1.3.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
thanks @frreiss for the patch!
@meeseeksdev backport 1.3.x
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
$ git checkout 1.3.x
$ git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
$ git cherry-pick -m1 26e7c0f840197259f3af06a397df99b9b9f638a3
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
$ git commit -am 'Backport PR #42787: BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays'
```

4. Push to a named branch :

```
git push YOURFORK 1.3.x:auto-backport-of-pr-42787-on-1.3.x
```

5. Create a PR against branch 1.3.x, I would have named this PR:

> "Backport PR #42787 on branch 1.3.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
@frreiss if you wouldn't mind following the instructions above to manually backport this (above).
conflicts due to #42422. manual backport done in #42850