BUG: update cython to fix segfault accessing __kwdefaults__
State: closed

- [x] closes #26127
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

This ups the cython minimum version to fix bugs as seen in #26127. I've added a test which goes through the members of `_libs` to check that they don't segfault when accessed. If you manually install 0.28.2 and run the test, you'll see it segfault.

I'm not sure how to place this change in the "whatsnow", so I'd be happy if I could get some advice there (and anywhere else I've gone wrong, of course).

Labels:
name: Internals
description: Related to non-user accessible pandas implementation
name: Dependencies
description: Required and optional dependencies
name: Segfault
description: Non-Recoverable Error

Comments:
Actually, I'm seeing mentions of cython version requirements in v0.23.0.rst and v0.24.0.rst, so maybe that's the place to put it.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26140?src=pr&el=h1) Report
> Merging [#26140](https://codecov.io/gh/pandas-dev/pandas/pull/26140?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c18c8be779240be49872860ddbfec9bc5ef0a548?src=pr&el=desc) will **decrease** coverage by `51.25%`.
> The diff coverage is `n/a`.

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

```diff
@@             Coverage Diff             @@
##           master   #26140       +/-   ##
===========================================
- Coverage   91.99%   40.73%   -51.26%     
===========================================
  Files         175      175               
  Lines       52382    52382               
===========================================
- Hits        48188    21338    -26850     
- Misses       4194    31044    +26850
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `?` | |
| #single | `40.73% <ø> (-0.14%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26140?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/sas/sas\_constants.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfY29uc3RhbnRzLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/core/groupby/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9jYXRlZ29yaWNhbC5weQ==) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/plotting.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvcGxvdHRpbmcucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvY29udmVydGVyLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `0% <0%> (-99.37%)` | :arrow_down: |
| [pandas/io/sas/sas7bdat.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXM3YmRhdC5weQ==) | `0% <0%> (-91.16%)` | :arrow_down: |
| [pandas/io/sas/sas\_xport.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfeHBvcnQucHk=) | `0% <0%> (-90.1%)` | :arrow_down: |
| [pandas/core/tools/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvbnVtZXJpYy5weQ==) | `10.44% <0%> (-89.56%)` | :arrow_down: |
| [pandas/io/s3.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3MzLnB5) | `0% <0%> (-89.48%)` | :arrow_down: |
| ... and [130 more](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26140?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/26140?src=pr&el=footer). Last update [c18c8be...db6ac55](https://codecov.io/gh/pandas-dev/pandas/pull/26140?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/26140?src=pr&el=h1) Report
> Merging [#26140](https://codecov.io/gh/pandas-dev/pandas/pull/26140?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c18c8be779240be49872860ddbfec9bc5ef0a548?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #26140      +/-   ##
==========================================
- Coverage   91.99%   91.98%   -0.01%     
==========================================
  Files         175      175              
  Lines       52382    52382              
==========================================
- Hits        48188    48184       -4     
- Misses       4194     4198       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.54% <ø> (ø)` | :arrow_up: |
| #single | `40.73% <ø> (-0.14%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26140?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `75% <0%> (-12.5%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26140/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.9% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26140?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/26140?src=pr&el=footer). Last update [c18c8be...db6ac55](https://codecov.io/gh/pandas-dev/pandas/pull/26140?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Interesting, the 3.5 machines can't install cython 0.29.7 even though it should be available.
Might be an issue of availability of 3.5 builds for conda. @TomAugspurger if you have any insights
We can certainly ensure that the next set of wheels are built with new enough Cython. That would be in the pandas-release repo. 

> On Apr 19, 2019, at 10:01, Jeff Reback <notifications@github.com> wrote:
> 
> @jreback requested changes on this pull request.
> 
> i am -1 on this bump
> this has only been out for a month
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.

Closing as I don't think we have interest in this PR as is given how recent the Cython release is. Can reevaluate at a later date!