#23049: test for Fatal Stack Overflow stemming From Misuse of astype(…
State: closed

…'category')

- [x] closes #23049
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

The referenced issue seems to be solved in the current master. So added a test for the edge case.


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Categorical
description: Categorical Data Type

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=h1) Report
> Merging [#25366](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f74aba614554d1de4d7986fef6296a4eda951ac9?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25366/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #25366   +/-   ##
=======================================
  Coverage   91.73%   91.73%           
=======================================
  Files         173      173           
  Lines       52839    52839           
=======================================
  Hits        48472    48472           
  Misses       4367     4367
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.29% <ø> (ø)` | :arrow_up: |
| #single | `41.72% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=footer). Last update [f74aba6...86a8269](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=h1) Report
> Merging [#25366](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f74aba614554d1de4d7986fef6296a4eda951ac9?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25366/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #25366   +/-   ##
=======================================
  Coverage   91.73%   91.73%           
=======================================
  Files         173      173           
  Lines       52839    52839           
=======================================
  Hits        48472    48472           
  Misses       4367     4367
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.29% <ø> (ø)` | :arrow_up: |
| #single | `41.72% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=footer). Last update [f74aba6...86a8269](https://codecov.io/gh/pandas-dev/pandas/pull/25366?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks @TrigonaMinima