BLD: fix py37 build warnings
State: closed

Not at all sure this is the optimal way to do this, cc @WillAyd for suggestions

Labels:
name: Build
description: Library building on various platforms
name: Clean

Comments:
FYI here is the bpo patch which might be helpful to compare

https://bugs.python.org/issue22896
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26769?src=pr&el=h1) Report
> Merging [#26769](https://codecov.io/gh/pandas-dev/pandas/pull/26769?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/959e799396b0b9c2d99e69f03fddd925727c19f4?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/26769/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26769?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26769      +/-   ##
==========================================
- Coverage   91.71%    91.7%   -0.01%     
==========================================
  Files         178      178              
  Lines       50755    50755              
==========================================
- Hits        46552    46547       -5     
- Misses       4203     4208       +5
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.3% <ø> (ø)` | :arrow_up: |
| #single | `41.2% <ø> (-0.11%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26769?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.88% <0%> (-0.12%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.84% <0%> (-0.11%)` | :arrow_down: |

------

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

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

```diff
@@            Coverage Diff             @@
##           master   #26769      +/-   ##
==========================================
- Coverage   92.05%   91.97%   -0.09%     
==========================================
  Files         180      180              
  Lines       50726    50756      +30     
==========================================
- Hits        46696    46681      -15     
- Misses       4030     4075      +45
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.56% <ø> (-0.12%)` | :arrow_down: |
| #single | `41.82% <ø> (-0.16%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26769?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `88.88% <0%> (-11.12%)` | :arrow_down: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `88.2% <0%> (-1.19%)` | :arrow_down: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `96% <0%> (-0.87%)` | :arrow_down: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `93.73% <0%> (-0.79%)` | :arrow_down: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `94.38% <0%> (-0.77%)` | :arrow_down: |
| [pandas/core/dtypes/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL21pc3NpbmcucHk=) | `93.33% <0%> (-0.61%)` | :arrow_down: |
| [pandas/core/dtypes/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbmNhdC5weQ==) | `96.58% <0%> (-0.46%)` | :arrow_down: |
| [pandas/core/internals/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2NvbmNhdC5weQ==) | `96.48% <0%> (-0.37%)` | :arrow_down: |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `90.53% <0%> (-0.37%)` | :arrow_down: |
| [pandas/plotting/\_misc.py](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19taXNjLnB5) | `64.55% <0%> (-0.31%)` | :arrow_down: |
| ... and [17 more](https://codecov.io/gh/pandas-dev/pandas/pull/26769/diff?src=pr&el=tree-more) | |

------

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

lgtm. is @WillAyd comment relevant?
Will's comment is definitely relevant; the BPO conversation specifically describes this usage as unsafe.

Do we have anyone conversant in CPython internals we can hand this off to?

Do we have decent test coverage for msgpack?
I think this is fine as is but it's probably better to move the release of the object until after buf and buf_len have actually been used. Seems like as is could be at risk for segfault
@zooba any idea about the usage here ?
can you merge master, ping on green. prob ok to merge this.
Updated, but since segfaults are at risk and this isn't actively broken ATM I'd rather leave this open until we get someone more conversant in the C internals to sign off on it.  Any thoughts @scoder?
sure
lgtm. merge on green.
thanks @jbrockmendel